Skip to content

Commit

Permalink
Update Github Actions to use our local clone for running tests
Browse files Browse the repository at this point in the history
This allows test changes to be tested too, if they live in the PR with the image change.
  • Loading branch information
tianon committed May 15, 2020
1 parent d4642c3 commit eef6790
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://github.com/actions/checkout/issues/135#issuecomment-613361104
* text eol=lf
5 changes: 5 additions & 0 deletions .github/workflows/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ for repo; do
.matrix.include[]
| ([ .meta.entries[].tags[0] ]) as $tags
| .name = ($tags | join(", "))
# replace "build" steps with something that uses "bashbrew" instead of "docker build"
# https://github.com/docker-library/bashbrew/blob/a40a54d4d81b9fd2e39b4d7ba3fe203e8b022a67/scripts/github-actions/generate.sh#L74-L93
| .runs.prepare += "\ngit clone --depth 1 https://github.com/docker-library/bashbrew.git ~/bashbrew\n~/bashbrew/bashbrew.sh --version"
| .runs.build = (
(if .os | startswith("windows-") then "export BASHBREW_ARCH=windows-amd64 BASHBREW_CONSTRAINTS=" + ([ .meta.entries[].constraints[] ] | join(", ") | @sh) + "\n" else "" end)
+ "export BASHBREW_LIBRARY=\"$PWD/library\"\n"
+ ([ $tags[] | "~/bashbrew/bashbrew.sh build " + @sh ] | join("\n"))
)
# use our local clone of official-images for running tests (so test changes can be tested too, if they live in the PR with the image change)
# https://github.com/docker-library/bashbrew/blob/a40a54d4d81b9fd2e39b4d7ba3fe203e8b022a67/scripts/github-actions/generate.sh#L95
| .runs.test |= gsub("[^\n\t ]+/run[.]sh "; "./test/run.sh ")
]' <<<"$newStrategy")"
jq -c . <<<"$newStrategy" > /dev/null # sanity check
strategy="$(jq -c '
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ jobs:
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 '::set-env name=MSYS::winsymlinks:nativestrict'
# https://github.com/docker-library/bashbrew/blob/a40a54d4d81b9fd2e39b4d7ba3fe203e8b022a67/scripts/github-actions/generate.sh#L146-L149
if: runner.os == 'Windows'
- uses: actions/checkout@v2
- name: Prepare Environment
run: ${{ matrix.runs.prepare }}
Expand Down

0 comments on commit eef6790

Please sign in to comment.