Skip to content

Commit 6dafa6d

Browse files
committed
Parallelize main CI jobs
1 parent db417da commit 6dafa6d

File tree

1 file changed

+83
-23
lines changed

1 file changed

+83
-23
lines changed

.github/workflows/docker.yml

Lines changed: 83 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,123 @@ on:
66
pull_request:
77

88
jobs:
9-
docker-linux-build:
9+
# Parallelized: run quick docker build tests per-Dockerfile in parallel
10+
linux-dockerfile-test:
1011
runs-on: ubuntu-latest
1112
container:
1213
image: hairyhenderson/dockerfiles-builder:latest
1314
env:
1415
BASHBREW_LIBRARY: ./library
1516
BASHBREW_NAMESPACE: caddy
1617
DOCKER_BUILDKIT: '1'
18+
strategy:
19+
matrix:
20+
path:
21+
- 2.10/alpine
22+
- 2.10/builder
23+
- 2.11/alpine
24+
- 2.11/builder
1725
steps:
1826
- uses: actions/checkout@master
19-
- name: non-master build test
27+
- name: non-master build test (per-path)
2028
run: |
21-
docker build -f 2.10/alpine/Dockerfile 2.10/alpine
22-
docker build -f 2.10/builder/Dockerfile 2.10/builder
29+
docker build -f ${{ matrix.path }}/Dockerfile ${{ matrix.path }}
2330
if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master'
31+
32+
# Main linux bashbrew build.
33+
docker-linux-build:
34+
runs-on: ubuntu-latest
35+
container:
36+
image: hairyhenderson/dockerfiles-builder:latest
37+
env:
38+
BASHBREW_LIBRARY: ./library
39+
BASHBREW_NAMESPACE: caddy
40+
DOCKER_BUILDKIT: '1'
41+
needs: linux-dockerfile-test
42+
steps:
43+
- uses: actions/checkout@master
44+
2445
- name: build
2546
run: bashbrew build caddy
47+
2648
- name: push
49+
if: github.repository == 'caddyserver/caddy-docker' && github.ref == 'refs/heads/master'
2750
# NOTE: DOCKERHUB_TOKEN and DOCKERHUB_USERNAME must be present in https://github.com/caddyserver/caddy-docker/settings
2851
# the user must have permission to push to https://hub.docker.com/r/caddy/caddy
2952
run: |
3053
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
3154
bashbrew push caddy
32-
if: github.repository == 'caddyserver/caddy-docker' && github.ref == 'refs/heads/master'
55+
3356
- name: push (non-master dry run)
57+
if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master'
3458
run: |
3559
bashbrew push --dry-run caddy
36-
if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master'
3760
38-
docker-windows-build:
39-
runs-on: windows-2022
40-
# env:
41-
# BASHBREW_LIBRARY: ./library
42-
# BASHBREW_NAMESPACE: caddy
61+
62+
# Parallelized: run quick windows docker build tests per-Dockerfile in parallel
63+
windows-dockerfile-test:
64+
runs-on: ${{ matrix.runner }}
65+
strategy:
66+
matrix:
67+
include:
68+
- path: 2.10/windows/ltsc2022
69+
runner: windows-2022
70+
- path: 2.10/windows-nanoserver/ltsc2022
71+
runner: windows-2022
72+
- path: 2.10/windows/ltsc2025
73+
runner: windows-2025
74+
- path: 2.10/windows-nanoserver/ltsc2025
75+
runner: windows-2025
76+
- path: 2.11/windows/ltsc2022
77+
runner: windows-2022
78+
- path: 2.11/windows-nanoserver/ltsc2022
79+
runner: windows-2022
80+
- path: 2.11/windows/ltsc2025
81+
runner: windows-2025
82+
- path: 2.11/windows-nanoserver/ltsc2025
83+
runner: windows-2025
4384
steps:
4485
- uses: actions/checkout@master
45-
- name: non-master build test
46-
run: |
47-
docker build -f 2.10/windows/ltsc2022/Dockerfile 2.10/windows/ltsc2022
48-
docker build -f 2.10/windows-nanoserver/ltsc2022/Dockerfile 2.10/windows-nanoserver/ltsc2022
86+
- name: non-master build test (per-path)
4987
if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master'
88+
run: |
89+
docker build -f ${{ matrix.path }}/Dockerfile ${{ matrix.path }}
90+
91+
# Main windows build (matrix over constraints) - runs after tests
92+
windows-build:
93+
needs: windows-dockerfile-test
94+
runs-on: ${{ matrix.runner }}
95+
strategy:
96+
matrix:
97+
include:
98+
- constraint: windowsservercore-ltsc2022
99+
runner: windows-2022
100+
- constraint: windowsnanoserver-ltsc2022
101+
runner: windows-2022
102+
- constraint: windowsservercore-ltsc2025
103+
runner: windows-2025
104+
- constraint: windowsnanoserver-ltsc2025
105+
runner: windows-2025
106+
steps:
107+
- uses: actions/checkout@master
108+
50109
- name: install bashbrew
51110
run: curl -o /bashbrew.exe https://doi-janky.infosiftr.net/job/bashbrew/job/master/lastSuccessfulBuild/artifact/bashbrew-windows-amd64.exe
111+
52112
- name: build
53113
run: |
54-
/bashbrew --arch windows-amd64 --constraint windowsservercore-ltsc2022 --namespace caddy --library ./library build caddy;
55-
/bashbrew --arch windows-amd64 --constraint windowsnanoserver-ltsc2022 --namespace caddy --library ./library build caddy
114+
/bashbrew --arch windows-amd64 --constraint ${{ matrix.constraint }} --namespace caddy --library ./library build caddy
115+
56116
- name: push
117+
if: github.repository == 'caddyserver/caddy-docker' && github.ref == 'refs/heads/master'
57118
# NOTE: DOCKERHUB_TOKEN and DOCKERHUB_USERNAME must be present in https://github.com/caddyserver/caddy-docker/settings
58119
# the user must have permission to push to https://hub.docker.com/r/caddy/caddy
59120
run: |
60121
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin;
61-
/bashbrew --arch windows-amd64 --constraint windowsservercore-ltsc2022 --namespace caddy --library ./library push caddy;
62-
/bashbrew --arch windows-amd64 --constraint windowsnanoserver-ltsc2022 --namespace caddy --library ./library push caddy
63-
if: github.repository == 'caddyserver/caddy-docker' && github.ref == 'refs/heads/master'
122+
/bashbrew --arch windows-amd64 --constraint ${{ matrix.constraint }} --namespace caddy --library ./library push caddy
123+
64124
- name: push (non-master dry run)
65-
run: |
66-
/bashbrew --arch windows-amd64 --constraint windowsservercore-ltsc2022 --namespace caddy --library ./library push --dry-run caddy;
67-
/bashbrew --arch windows-amd64 --constraint windowsnanoserver-ltsc2022 --namespace caddy --library ./library push --dry-run caddy
68125
if: github.repository != 'caddyserver/caddy-docker' || github.ref != 'refs/heads/master'
126+
run: |
127+
/bashbrew --arch windows-amd64 --constraint ${{ matrix.constraint }} --namespace caddy --library ./library push --dry-run caddy
128+

0 commit comments

Comments
 (0)