Skip to content

Commit 7110897

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

2 files changed

Lines changed: 200 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: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
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+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: docker/setup-qemu-action@v3
51+
- uses: docker/setup-buildx-action@v3
52+
-
53+
if: github.ref == 'refs/heads/github-actions'
54+
name: Login to ghcr.io
55+
uses: docker/login-action@v3
56+
with:
57+
registry: ghcr.io
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.GITHUB_TOKEN }}
60+
-
61+
if: github.ref == 'refs/heads/github-actions'
62+
name: Login to hub.docker.com
63+
uses: docker/login-action@v3
64+
with:
65+
username: ${{ secrets.DOCKERHUB_USERNAME }}
66+
password: ${{ secrets.DOCKERHUB_TOKEN }}
67+
-
68+
name: Build
69+
uses: docker/build-push-action@v6
70+
with:
71+
context: docker/bootstrap/alpine
72+
load: true
73+
tags: webdevops/bootstrap:alpine
74+
platforms: linux/amd64
75+
- name: run serverspec
76+
run: |
77+
cd tests/serverspec
78+
echo "FROM webdevops/bootstrap:alpine" >> Dockerfile_696e41bf715e49.28746787
79+
echo "COPY conf/ /" >> Dockerfile_696e41bf715e49.28746787
80+
bundle install
81+
bash serverspec.sh spec/docker/bootstrap_spec.rb webdevops/bootstrap:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jvb3RzdHJhcDphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE1ZTQ5LjI4NzQ2Nzg3In0= Dockerfile_696e41bf715e49.28746787
82+
83+
- name: run structure-test
84+
run: |
85+
cd tests/structure-test
86+
/usr/local/bin/container-structure-test test --image webdevops/bootstrap:alpine --config bootstrap/test.yaml --config bootstrap/alpine/test.yaml
87+
88+
-
89+
if: github.ref == 'refs/heads/github-actions'
90+
name: push
91+
uses: docker/build-push-action@v6
92+
with:
93+
context: docker/bootstrap/alpine
94+
push: true
95+
tags: ghcr.io/webdevops/bootstrap:alpine,webdevops/bootstrap:alpine
96+
platforms: linux/amd64,linux/arm64
97+
98+
webdevops-base-alpine:
99+
needs: ['webdevops-bootstrap-alpine']
100+
runs-on: ubuntu-latest
101+
container: webdevops/dockerfile-build-env
102+
steps:
103+
- uses: actions/checkout@v4
104+
- uses: docker/setup-qemu-action@v3
105+
- uses: docker/setup-buildx-action@v3
106+
-
107+
if: github.ref == 'refs/heads/github-actions'
108+
name: Login to ghcr.io
109+
uses: docker/login-action@v3
110+
with:
111+
registry: ghcr.io
112+
username: ${{ github.actor }}
113+
password: ${{ secrets.GITHUB_TOKEN }}
114+
-
115+
if: github.ref == 'refs/heads/github-actions'
116+
name: Login to hub.docker.com
117+
uses: docker/login-action@v3
118+
with:
119+
username: ${{ secrets.DOCKERHUB_USERNAME }}
120+
password: ${{ secrets.DOCKERHUB_TOKEN }}
121+
-
122+
name: Build
123+
uses: docker/build-push-action@v6
124+
with:
125+
context: docker/base/alpine
126+
load: true
127+
tags: webdevops/base:alpine
128+
platforms: linux/amd64
129+
- name: run serverspec
130+
run: |
131+
cd tests/serverspec
132+
echo "FROM webdevops/base:alpine" >> Dockerfile_696e41bf7160e6.29634751
133+
echo "COPY conf/ /" >> Dockerfile_696e41bf7160e6.29634751
134+
bundle install
135+
bash serverspec.sh spec/docker/base_spec.rb webdevops/base:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jhc2U6YWxwaW5lIiwiRE9DS0VSX1RBRyI6ImFscGluZSIsIk9TX0ZBTUlMWSI6ImFscGluZSIsIk9TX1ZFUlNJT04iOiIiLCJET0NLRVJGSUxFIjoiRG9ja2VyZmlsZV82OTZlNDFiZjcxNjBlNi4yOTYzNDc1MSJ9 Dockerfile_696e41bf7160e6.29634751
136+
137+
- name: run structure-test
138+
run: |
139+
cd tests/structure-test
140+
/usr/local/bin/container-structure-test test --image webdevops/base:alpine --config base/test.yaml --config base/alpine/test.yaml
141+
142+
-
143+
if: github.ref == 'refs/heads/github-actions'
144+
name: push
145+
uses: docker/build-push-action@v6
146+
with:
147+
context: docker/base/alpine
148+
push: true
149+
tags: ghcr.io/webdevops/base:alpine,webdevops/base:alpine
150+
platforms: linux/amd64,linux/arm64
151+
152+
webdevops-apache-alpine:
153+
needs: ['webdevops-base-alpine']
154+
runs-on: ubuntu-latest
155+
container: webdevops/dockerfile-build-env
156+
steps:
157+
- uses: actions/checkout@v4
158+
- uses: docker/setup-qemu-action@v3
159+
- uses: docker/setup-buildx-action@v3
160+
-
161+
if: github.ref == 'refs/heads/github-actions'
162+
name: Login to ghcr.io
163+
uses: docker/login-action@v3
164+
with:
165+
registry: ghcr.io
166+
username: ${{ github.actor }}
167+
password: ${{ secrets.GITHUB_TOKEN }}
168+
-
169+
if: github.ref == 'refs/heads/github-actions'
170+
name: Login to hub.docker.com
171+
uses: docker/login-action@v3
172+
with:
173+
username: ${{ secrets.DOCKERHUB_USERNAME }}
174+
password: ${{ secrets.DOCKERHUB_TOKEN }}
175+
-
176+
name: Build
177+
uses: docker/build-push-action@v6
178+
with:
179+
context: docker/apache/alpine
180+
load: true
181+
tags: webdevops/apache:alpine
182+
platforms: linux/amd64
183+
- name: run serverspec
184+
run: |
185+
cd tests/serverspec
186+
echo "FROM webdevops/apache:alpine" >> Dockerfile_696e41bf7162b9.73549954
187+
echo "COPY conf/ /" >> Dockerfile_696e41bf7162b9.73549954
188+
bundle install
189+
bash serverspec.sh spec/docker/apache_spec.rb webdevops/apache:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2FwYWNoZTphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE2MmI5LjczNTQ5OTU0In0= Dockerfile_696e41bf7162b9.73549954
190+
191+
-
192+
if: github.ref == 'refs/heads/github-actions'
193+
name: push
194+
uses: docker/build-push-action@v6
195+
with:
196+
context: docker/apache/alpine
197+
push: true
198+
tags: ghcr.io/webdevops/apache:alpine,webdevops/apache:alpine
199+
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)