Skip to content

Commit 752b299

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

2 files changed

Lines changed: 97 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: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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+
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: ghcr.io/webdevops/bootstrap:alpine,webdevops/bootstrap:alpine
74+
platforms: linux/amd64,linux/arm64
75+
- name: run serverspec
76+
run: |
77+
cd tests/serverspec
78+
echo "FROM webdevops/bootstrap:alpine" >> Dockerfile_test
79+
echo "COPY conf/ /" >> Dockerfile_test
80+
bundle install
81+
bash serverspec.sh spec/docker/bootstrap_spec.rb webdevops/bootstrap:alpine eyJET0NLRVJfSU1BR0UiOiJ3ZWJkZXZvcHNcL2Jvb3RzdHJhcDphbHBpbmUiLCJET0NLRVJfVEFHIjoiYWxwaW5lIiwiT1NfRkFNSUxZIjoiYWxwaW5lIiwiT1NfVkVSU0lPTiI6IiIsIkRPQ0tFUkZJTEUiOiJEb2NrZXJmaWxlXzY5NmU0MWJmNzE1ZTQ5LjI4NzQ2Nzg3In0= Dockerfile_test
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

0 commit comments

Comments
 (0)