Skip to content

Commit a1def1b

Browse files
committed
[WIP] add github workflow build
1 parent ebc4fac commit a1def1b

2 files changed

Lines changed: 209 additions & 1 deletion

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ insert_final_newline = false
1717
[Makefile]
1818
indent_style = tab
1919

20-
[*.yml]
20+
[{*.yml,*.yaml}]
2121
indent_size = 2
2222

2323
[*.conf]

.github/workflows/build.yaml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
name: build
2+
3+
on:
4+
schedule:
5+
# build every day at midnight
6+
- cron: '0 0 * * *'
7+
push:
8+
pull_request:
9+
branches: [ master ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
webdevops-toolbox-latest:
14+
runs-on: ubuntu-latest
15+
# container: webdevops/dockerfile-build-env # not needed and way faster if not used
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: docker/setup-qemu-action@v3
19+
- uses: docker/setup-buildx-action@v3
20+
-
21+
if: github.ref == 'refs/heads/github-actions'
22+
name: Login to ghcr.io
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
-
29+
if: github.ref == 'refs/heads/github-actions'
30+
name: Login to hub.docker.com
31+
uses: docker/login-action@v3
32+
with:
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKERHUB_TOKEN }}
35+
-
36+
name: Build and push
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: docker/toolbox/latest
40+
push: ${{ github.ref == 'refs/heads/github-actions' }}
41+
tags: ghcr.io/webdevops/toolbox:latest,webdevops/toolbox:latest
42+
platforms: linux/amd64,linux/arm64
43+
44+
webdevops-bootstrap-alpine:
45+
needs: ['webdevops-toolbox-latest']
46+
runs-on: ubuntu-latest
47+
container: webdevops/dockerfile-build-env
48+
strategy:
49+
matrix:
50+
platform: [ linux/amd64, linux/arm64 ]
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: docker/setup-qemu-action@v3
54+
- uses: docker/setup-buildx-action@v3
55+
-
56+
if: github.ref == 'refs/heads/github-actions'
57+
name: Login to ghcr.io
58+
uses: docker/login-action@v3
59+
with:
60+
registry: ghcr.io
61+
username: ${{ github.actor }}
62+
password: ${{ secrets.GITHUB_TOKEN }}
63+
-
64+
if: github.ref == 'refs/heads/github-actions'
65+
name: Login to hub.docker.com
66+
uses: docker/login-action@v3
67+
with:
68+
username: ${{ secrets.DOCKERHUB_USERNAME }}
69+
password: ${{ secrets.DOCKERHUB_TOKEN }}
70+
-
71+
name: Build
72+
uses: docker/build-push-action@v6
73+
with:
74+
context: docker/bootstrap/alpine
75+
load: true
76+
tags: webdevops/bootstrap:alpine
77+
platforms: ${{ matrix.platform }}
78+
- name: run serverspec
79+
run: |
80+
cd tests/serverspec
81+
echo "FROM webdevops/bootstrap:alpine" >> Dockerfile_696e41bf715e49.28746787
82+
echo "COPY conf/ /" >> Dockerfile_696e41bf715e49.28746787
83+
bundle install
84+
bash serverspec.sh spec/docker/bootstrap_spec.rb webdevops/bootstrap:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jvb3RzdHJhcDphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE1ZTQ5LjI4NzQ2Nzg3In0= Dockerfile_696e41bf715e49.28746787
85+
86+
- name: run structure-test
87+
run: |
88+
cd tests/structure-test
89+
/usr/local/bin/container-structure-test test --image webdevops/bootstrap:alpine --config bootstrap/test.yaml --config bootstrap/alpine/test.yaml
90+
91+
-
92+
if: github.ref == 'refs/heads/github-actions'
93+
name: push
94+
uses: docker/build-push-action@v6
95+
with:
96+
context: docker/bootstrap/alpine
97+
push: true
98+
tags: ghcr.io/webdevops/bootstrap:alpine,webdevops/bootstrap:alpine
99+
platforms: ${{ matrix.platform }}
100+
101+
webdevops-base-alpine:
102+
needs: ['webdevops-bootstrap-alpine']
103+
runs-on: ubuntu-latest
104+
container: webdevops/dockerfile-build-env
105+
strategy:
106+
matrix:
107+
platform: [ linux/amd64, linux/arm64 ]
108+
steps:
109+
- uses: actions/checkout@v4
110+
- uses: docker/setup-qemu-action@v3
111+
- uses: docker/setup-buildx-action@v3
112+
-
113+
if: github.ref == 'refs/heads/github-actions'
114+
name: Login to ghcr.io
115+
uses: docker/login-action@v3
116+
with:
117+
registry: ghcr.io
118+
username: ${{ github.actor }}
119+
password: ${{ secrets.GITHUB_TOKEN }}
120+
-
121+
if: github.ref == 'refs/heads/github-actions'
122+
name: Login to hub.docker.com
123+
uses: docker/login-action@v3
124+
with:
125+
username: ${{ secrets.DOCKERHUB_USERNAME }}
126+
password: ${{ secrets.DOCKERHUB_TOKEN }}
127+
-
128+
name: Build
129+
uses: docker/build-push-action@v6
130+
with:
131+
context: docker/base/alpine
132+
load: true
133+
tags: webdevops/base:alpine
134+
platforms: ${{ matrix.platform }}
135+
- name: run serverspec
136+
run: |
137+
cd tests/serverspec
138+
echo "FROM webdevops/base:alpine" >> Dockerfile_696e41bf7160e6.29634751
139+
echo "COPY conf/ /" >> Dockerfile_696e41bf7160e6.29634751
140+
bundle install
141+
bash serverspec.sh spec/docker/base_spec.rb webdevops/base:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jhc2U6YWxwaW5lIiwiRE9DS0VSX1RBRyI6ImFscGluZSIsIk9TX0ZBTUlMWSI6ImFscGluZSIsIk9TX1ZFUlNJT04iOiIiLCJET0NLRVJGSUxFIjoiRG9ja2VyZmlsZV82OTZlNDFiZjcxNjBlNi4yOTYzNDc1MSJ9 Dockerfile_696e41bf7160e6.29634751
142+
143+
- name: run structure-test
144+
run: |
145+
cd tests/structure-test
146+
/usr/local/bin/container-structure-test test --image webdevops/base:alpine --config base/test.yaml --config base/alpine/test.yaml
147+
148+
-
149+
if: github.ref == 'refs/heads/github-actions'
150+
name: push
151+
uses: docker/build-push-action@v6
152+
with:
153+
context: docker/bootstrap/alpine
154+
push: true
155+
tags: ghcr.io/webdevops/base:alpine,webdevops/base:alpine
156+
platforms: ${{ matrix.platform }}
157+
158+
webdevops-apache-alpine:
159+
needs: ['webdevops-base-alpine']
160+
runs-on: ubuntu-latest
161+
container: webdevops/dockerfile-build-env
162+
strategy:
163+
matrix:
164+
platform: [ linux/amd64, linux/arm64 ]
165+
steps:
166+
- uses: actions/checkout@v4
167+
- uses: docker/setup-qemu-action@v3
168+
- uses: docker/setup-buildx-action@v3
169+
-
170+
if: github.ref == 'refs/heads/github-actions'
171+
name: Login to ghcr.io
172+
uses: docker/login-action@v3
173+
with:
174+
registry: ghcr.io
175+
username: ${{ github.actor }}
176+
password: ${{ secrets.GITHUB_TOKEN }}
177+
-
178+
if: github.ref == 'refs/heads/github-actions'
179+
name: Login to hub.docker.com
180+
uses: docker/login-action@v3
181+
with:
182+
username: ${{ secrets.DOCKERHUB_USERNAME }}
183+
password: ${{ secrets.DOCKERHUB_TOKEN }}
184+
-
185+
name: Build
186+
uses: docker/build-push-action@v6
187+
with:
188+
context: docker/apache/alpine
189+
load: true
190+
tags: webdevops/apache:alpine
191+
platforms: ${{ matrix.platform }}
192+
- name: run serverspec
193+
run: |
194+
cd tests/serverspec
195+
echo "FROM webdevops/apache:alpine" >> Dockerfile_696e41bf7162b9.73549954
196+
echo "COPY conf/ /" >> Dockerfile_696e41bf7162b9.73549954
197+
bundle install
198+
bash serverspec.sh spec/docker/apache_spec.rb webdevops/apache:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2FwYWNoZTphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE2MmI5LjczNTQ5OTU0In0= Dockerfile_696e41bf7162b9.73549954
199+
200+
-
201+
if: github.ref == 'refs/heads/github-actions'
202+
name: push
203+
uses: docker/build-push-action@v6
204+
with:
205+
context: docker/bootstrap/alpine
206+
push: true
207+
tags: ghcr.io/webdevops/apache:alpine,webdevops/apache:alpine
208+
platforms: ${{ matrix.platform }}

0 commit comments

Comments
 (0)