Skip to content

Commit d82bf2d

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

2 files changed

Lines changed: 100 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: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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 }}

0 commit comments

Comments
 (0)