-
Notifications
You must be signed in to change notification settings - Fork 76
136 lines (131 loc) · 4.58 KB
/
dockerimage-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Docker Image CI
on:
create:
workflow_dispatch:
schedule:
- cron: '15 05 * * 1' # Late night for the Americas, early morning for Europe
pull_request:
paths-ignore:
- '**.md'
branches:
- master
push:
paths-ignore:
- '**.md'
tags-ignore:
- '**'
branches:
- master
- fork/master
- el8_migration
jobs:
code_check:
name: Code checks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ludeeus/[email protected]
env:
SHELLCHECK_OPTS: -x
- name: Install eclint
run: sudo npm install -g eclint
- name: Check EditorConfig compliance
run: eclint check $(git ls-files)
build_pr:
name: "Test Build Docker images"
if: github.event_name == 'pull_request' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'amd64'
- 'arm64'
env:
BUILD_AMD64: ${{ fromJSON('[0, 1]')[matrix.arch == 'amd64'] }}
BUILD_ARM64: ${{ fromJSON('[0, 1]')[matrix.arch == 'arm64'] }}
steps:
- uses: actions/checkout@v4
- name: Set lower case repository owner name
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
env:
OWNER: '${{ github.repository_owner }}'
- name: Enable docker multiarch
run: 'docker run --privileged --rm tonistiigi/binfmt --install all'
- name: Fix docker logs
run: docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=-1,env.BUILDKIT_STEP_LOG_MAX_SPEED=-1,default-load=true --use
- name: Build the Docker images
run: make DISABLE_OPTIMIZATIONS=1 "OWNER=$OWNER_LC"
build_edge:
name: "Build edge Docker images"
if: github.event_name != 'create' && github.event_name != 'pull_request' && github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'amd64'
- 'arm64'
env:
BUILD_AMD64: ${{ fromJSON('[0, 1]')[matrix.arch == 'amd64'] }}
BUILD_ARM64: ${{ fromJSON('[0, 1]')[matrix.arch == 'arm64'] }}
steps:
- uses: actions/checkout@v4
- name: Set lower case repository owner name
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
env:
OWNER: '${{ github.repository_owner }}'
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Enable docker multiarch
run: 'docker run --privileged --rm tonistiigi/binfmt --install all'
- name: Fix docker logs
run: docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=-1,env.BUILDKIT_STEP_LOG_MAX_SPEED=-1,default-load=true --use
- name: Build the Docker images
run: make "OWNER=$OWNER_LC" VERSION=edge
- name: Push the Docker images
run: docker push "ghcr.io/$OWNER_LC/holy-build-box:edge"
build_release:
name: "Build release Docker images"
if: github.event_name == 'create' && github.event.ref_type == 'tag'
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'amd64'
- 'arm64'
env:
BUILD_AMD64: ${{ fromJSON('[0, 1]')[matrix.arch == 'amd64'] }}
BUILD_ARM64: ${{ fromJSON('[0, 1]')[matrix.arch == 'arm64'] }}
steps:
- uses: actions/checkout@v4
- name: Set lower case repository owner name
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
env:
OWNER: '${{ github.repository_owner }}'
- name: Check versions match (Makefile & git-tag)
run: |
MAKEFILE_VERSION=$(grep '^VERSION = ' Makefile | sed 's|.*= *||')
GIT_TAG_VERSION=$(sed 's|^rel-||' <<< "$TAG")
if [[ "MAKEFILE_$VERSION" != "$GIT_TAG_VERSION" ]]; then
echo "ERROR: version in Makefile ($MAKEFILE_VERSION) doesn't match Git tag ($GIT_TAG_VERSION)"
exit 1
fi
env:
TAG: ${{ github.event.ref }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Enable docker multiarch
run: 'docker run --privileged --rm tonistiigi/binfmt --install all'
- name: Fix docker logs
run: docker buildx create --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=-1,env.BUILDKIT_STEP_LOG_MAX_SPEED=-1,default-load=true --use
- name: Build the Docker images
run: make build "OWNER=$OWNER_LC"
- name: Tag and push the Docker images
run: make release "OWNER=$OWNER_LC"