Skip to content

Commit 58ca416

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

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
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+
id: docker_build
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: docker/toolbox/latest
41+
push: ${{ github.ref == 'refs/heads/github-actions' }}
42+
tags: ghcr.io/webdevops/toolbox:latest,webdevops/toolbox:latest
43+
platforms: linux/amd64,linux/arm64
44+
45+
webdevops-bootstrap-alpine:
46+
needs: ['webdevops-toolbox-latest']
47+
runs-on: ubuntu-latest
48+
container: webdevops/dockerfile-build-env
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: docker/setup-qemu-action@v3
52+
- uses: docker/setup-buildx-action@v3
53+
-
54+
if: github.ref == 'refs/heads/github-actions'
55+
name: Login to ghcr.io
56+
uses: docker/login-action@v3
57+
with:
58+
registry: ghcr.io
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
-
62+
if: github.ref == 'refs/heads/github-actions'
63+
name: Login to hub.docker.com
64+
uses: docker/login-action@v3
65+
with:
66+
username: ${{ secrets.DOCKERHUB_USERNAME }}
67+
password: ${{ secrets.DOCKERHUB_TOKEN }}
68+
-
69+
name: Build
70+
id: docker_build
71+
uses: docker/build-push-action@v6
72+
with:
73+
context: docker/bootstrap/alpine
74+
load: true
75+
tags: ghcr.io/webdevops/bootstrap:alpine,webdevops/bootstrap:alpine
76+
platforms: linux/amd64,linux/arm64
77+
- name: run serverspec
78+
run: |
79+
cd tests/serverspec
80+
echo "FROM webdevops/bootstrap:alpine" >> Dockerfile_test
81+
echo "COPY conf/ /" >> Dockerfile_test
82+
bundle install
83+
bash serverspec.sh spec/docker/bootstrap_spec.rb webdevops/bootstrap:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jvb3RzdHJhcDphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE1ZTQ5LjI4NzQ2Nzg3In0= Dockerfile_test
84+
85+
- name: run structure-test
86+
run: |
87+
cd tests/structure-test
88+
/usr/local/bin/container-structure-test test --image webdevops/bootstrap:alpine --config bootstrap/test.yaml --config bootstrap/alpine/test.yaml
89+
90+
-
91+
if: github.ref == 'refs/heads/github-actions'
92+
name: push
93+
id: docker_build
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: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)