forked from docker-library/official-images
-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (75 loc) · 2.76 KB
/
test-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Test PR
on:
pull_request:
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
env:
# https://github.com/docker-library/bashbrew/issues/10
GIT_LFS_SKIP_SMUDGE: 1
# cancel existing runs if user makes another push
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
naughty:
name: Naughty
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check for Common Issues
run: |
git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew
~/bashbrew/bashbrew.sh --version > /dev/null
export PATH="$HOME/bashbrew/bin:$PATH"
bashbrew --version
.github/workflows/naughty.sh
generate-jobs:
name: Generate Jobs
runs-on: ubuntu-latest
outputs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
length: ${{ steps.generate-jobs.outputs.length }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: generate-jobs
name: Generate Jobs
run: |
git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew
strategy="$(.github/workflows/generate.sh ~/bashbrew)"
jq . <<<"$strategy" # sanity check / debugging aid
echo "::set-output name=strategy::$strategy"
length="$(jq <<<"$strategy" -r '.matrix.include | length')"
echo "::set-output name=length::$length"
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@v2
- name: Prepare Environment
run: ${{ matrix.runs.prepare }}
- name: Pull Dependencies
run: ${{ matrix.runs.pull }}
- name: Build ${{ matrix.name }}
run: ${{ matrix.runs.build }}
- name: History ${{ matrix.name }}
run: ${{ matrix.runs.history }}
- name: Test ${{ matrix.name }}
run: ${{ matrix.runs.test }}
- name: '"docker images"'
run: ${{ matrix.runs.images }}