Skip to content

Commit

Permalink
merge upstream improvements to test CI action
Browse files Browse the repository at this point in the history
  • Loading branch information
gdams committed Aug 14, 2023
1 parent f308aa1 commit ccf51e1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/.bashbrew/action.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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'
18 changes: 17 additions & 1 deletion .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down

0 comments on commit ccf51e1

Please sign in to comment.