diff --git a/.github/workflows/.bashbrew/action.yml b/.github/workflows/.bashbrew/action.yml new file mode 100644 index 000000000..aba6e2c86 --- /dev/null +++ b/.github/workflows/.bashbrew/action.yml @@ -0,0 +1,19 @@ +# https://github.com/docker-library/official-images/pull/13556#issuecomment-1319181339 🙈 +name: 'Shared Bashbrew Action' +description: 'Install the same version of Bashbrew consistently in all other GitHub Actions' +inputs: + build: + default: 'host' # or 'docker' or 'none' +runs: + using: 'composite' + steps: + + # these two version numbers are intentionally as close together as I could possibly get them because no matter what I tried, GitHub will not allow me to DRY them (can't have any useful variables in `uses:` and can't even have YAML references to steal it in `env:` or something) + - shell: 'bash -Eeuo pipefail -x {0}' + run: echo BASHBREW_VERSION=v0.1.8 >> "$GITHUB_ENV" + - uses: docker-library/bashbrew@v0.1.8 + if: inputs.build == 'host' + + - run: docker build --pull --tag oisupport/bashbrew:base "https://github.com/docker-library/bashbrew.git#$BASHBREW_VERSION" + shell: 'bash -Eeuo pipefail -x {0}' + if: inputs.build == 'docker' diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index a79f8fc8e..f3c7fd22c 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -17,9 +17,12 @@ jobs: runs-on: ubuntu-latest outputs: strategy: ${{ steps.generate-jobs.outputs.strategy }} + length: ${{ steps.generate-jobs.outputs.length }} steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - uses: docker-library/bashbrew@7e160dca3123caecf32c33ba31821dd2aa3716cd # v0.1.8 + with: + fetch-depth: 0 + - uses: ./.github/workflows/.bashbrew - id: generate-jobs name: Generate Jobs run: | @@ -28,13 +31,26 @@ jobs: strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")" echo "strategy=$strategy" >> "$GITHUB_OUTPUT" jq . <<<"$strategy" # sanity check / debugging aid + length="$(jq <<<"$strategy" -r '.matrix.include | length')" + echo "length=$length" >> "$GITHUB_OUTPUT" + test: needs: generate-jobs strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} + if: needs.generate-jobs.outputs.length > 0 name: ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: + - name: Prepare Git + run: | + # enable symlinks on Windows (https://git-scm.com/docs/git-config#Documentation/git-config.txt-coresymlinks) + git config --global core.symlinks true + # also, make sure Windows symlinks are *real* symlinks (https://github.com/git-for-windows/git/pull/156) + echo 'MSYS=winsymlinks:nativestrict' >> "$GITHUB_ENV" + # https://github.com/docker-library/bashbrew/blob/a40a54d4d81b9fd2e39b4d7ba3fe203e8b022a67/scripts/github-actions/generate.sh#L146-L149 + if: runner.os == 'Windows' - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - uses: ./.github/workflows/.bashbrew - name: Prepare Environment run: ${{ matrix.runs.prepare }} - name: Pull Dependencies