Merge pull request #24 from abhinav/resolve-before-arch #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
push: | |
branches: [main] | |
tags: [v*] | |
pull_request: | |
branches: [main] | |
env: | |
GO_BOOTSTRAP_VERSION: 1.17.13 | |
SHELLCHECK_URL: "https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz" | |
SHFMT_URL: "https://github.com/mvdan/sh/releases/download/v3.5.1/shfmt_v3.5.1_linux_amd64" | |
jobs: | |
prebuild: | |
strategy: | |
matrix: | |
runner: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- uses: actions/checkout@v3 | |
- if: runner.os == 'macOS' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gimme | |
~/go/pkg/mod | |
~/Library/Caches/go-build | |
key: "${{ runner.os }}-prebuild-${{ hashFiles('go.sum') }}" | |
restore-keys: | | |
${{ runner.os }}-prebuild- | |
- if: runner.os == 'Linux' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gimme | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: "${{ runner.os }}-prebuild-${{ hashFiles('go.sum') }}" | |
restore-keys: | | |
${{ runner.os }}-prebuild- | |
- run: ./gimme module | grep ^export | tee -a "${GITHUB_ENV}" | |
- run: make gimme-generate | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: gimme-generate-${{ runner.os }} | |
path: gimme-generate | |
matrix: | |
name: matrix | |
needs: [prebuild] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: gimme-generate-${{ runner.os }} | |
- run: chmod -v +x gimme-generate | |
- id: env | |
run: make matrix | |
- run: make assert-no-diff | |
outputs: | |
env: ${{ steps.env.outputs.env }} | |
test: | |
needs: [matrix] | |
strategy: | |
matrix: | |
env: ${{ fromJson(needs.matrix.outputs.env) }} | |
runs-on: ${{ matrix.env.runner }} | |
env: | |
TARGET: ${{ matrix.env.target }} | |
steps: | |
- uses: actions/checkout@v3 | |
- if: runner.os == 'macOS' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gimme | |
key: "${{ runner.os }}-${{ matrix.env.target }}-${{ matrix.env.version }}-test-${{ hashFiles('.testdata/sample-binary-*') }}" | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.env.target }}-${{ matrix.env.version }}-test- | |
${{ runner.os }}-${{ matrix.env.target }}- | |
- if: runner.os == 'Linux' | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gimme | |
key: "${{ runner.os }}-${{ matrix.env.target }}-${{ matrix.env.version }}-test-${{ hashFiles('.testdata/sample-binary-*') }}" | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.env.target }}-${{ matrix.env.version }}-test- | |
${{ runner.os }}-${{ matrix.env.target }}- | |
- uses: actions/download-artifact@v3 | |
with: | |
name: gimme-generate-${{ runner.os }} | |
- run: | | |
chmod -v +x gimme-generate | |
printf 'GIMME_TMP=%s\n' "${RUNNER_TEMP}" | tee -a "${GITHUB_ENV}" | |
printf 'PATH=%s\n' "${HOME}/bin:${PATH}" | tee -a "${GITHUB_ENV}" | |
mkdir -p ~/bin | |
- name: ensure shell linting tools | |
if: runner.os == 'Linux' | |
run: | | |
if [[ $(shellcheck --version | awk '/^version:/ { print $2 }') != 0.7.1 ]] ; then | |
curl -sSL -o "${GIMME_TMP}/shellcheck.tar.xz" "${SHELLCHECK_URL}"; | |
tar -C ~/bin --exclude="*.txt" --strip-components=1 -xf "${GIMME_TMP}/shellcheck.tar.xz"; | |
shellcheck --version; | |
fi; | |
if [[ $(shfmt -version 2>/dev/null) != v3.5.1 ]] ; then | |
curl -sSL "${SHFMT_URL}" -o ~/bin/shfmt; | |
chmod +x ~/bin/shfmt; | |
shfmt -version; | |
fi | |
- if: runner.os == 'Linux' | |
run: make lint | |
- run: make assert-no-diff | |
- run: ./gimme -h | |
- run: ./gimme -V | |
- run: ./gimme -l | |
- run: ./runtests "${TARGET}" "${GO_BOOTSTRAP_VERSION}" '${{ matrix.env.version }}' | |
- run: ./gimme -l |