-
Notifications
You must be signed in to change notification settings - Fork 0
228 lines (211 loc) · 8.29 KB
/
knuth.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Build and Test
# on: [push, pull_request]
on:
push:
branches:
# - main # tagged latest
- master # tagged latest
# - dev # tagged test
- init
tags:
- v* # semver release
pull_request: # runs tests
workflow_dispatch: {}
env:
NAME: domain
CONAN_REMOTE: kth
CONAN_REMOTE_URL: https://packages.kth.cash/api/
jobs:
master:
name: Master and Dev
if: github.event_name != 'pull_request' &&
(github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/dev')
runs-on: ubuntu-20.04
steps:
- name: Master Build
shell: bash
run: |
echo "Stable packages are published in Release branches"
check:
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
outputs:
permitted: ${{ steps.check.outputs.permitted }}
steps:
- id: check
continue-on-error: true
uses: prince-chrismc/check-actor-permissions-action@v2
with:
permission: write
setup:
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
outputs:
build-version: ${{ steps.version.outputs.build-version }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- id: version
uses: ./ci_utils/.github/actions/determine-version
with:
github-ref: ${{ github.ref }}
run-number: ${{ github.run_number }}
# build-base-docker-image:
# name: Builds Alpine Docker image
# runs-on: ubuntu-latest
# outputs:
# # name: docker.pkg.github.com/${{ github.repository }}/alpine-image:${{ steps.version.outputs.version }}
# name: docker.pkg.github.com/k-nuth/kth/alpine-image:${{ steps.version.outputs.version }}
# env:
# # name: docker.pkg.github.com/${{ github.repository }}/alpine-image
# name: docker.pkg.github.com/k-nuth/kth/alpine-image
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true
# - id: version
# run: echo "version=${{ hashFiles('./ci_utils/Dockerfile.build') }}" >> $GITHUB_OUTPUT
# - uses: docker/login-action@v2
# with:
# registry: docker.pkg.github.com
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - id: check
# name: check existence
# run: |
# docker pull ${{ env.name }}:${{ steps.version.outputs.version }} > /dev/null && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
# - if: ${{ steps.check.outputs.exists == 'false' }}
# run: docker build . --file ./ci_utils/Dockerfile.build --tag ${{ env.name }}:${{ steps.version.outputs.version }}
# - if: ${{ steps.check.outputs.exists == 'false' }}
# run: docker push ${{ env.name }}:${{ steps.version.outputs.version }}
generate-matrix:
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/')
name: Generate Job Matrix
runs-on: ubuntu-20.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Download matrix configuration
run: |
curl -O https://raw.githubusercontent.com/k-nuth/ci-utils/master/.github/matrix.json
- name: Generate Job Matrix
id: set-matrix
run: |
MATRIX=$(cat ./matrix.json)
echo "${MATRIX}"
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
# calc-deps-with-container:
# needs: [setup, generate-matrix]
# strategy:
# matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/calc-deps-with-container.yml@master
# with:
# if: ${{ matrix.config.compiler == 'GCC' }}
# os: ${{ matrix.config.os }}
# image: "kthnode/gcc${{ matrix.config.version }}${{ matrix.config.docker_suffix }}"
# conan-remote: "kth"
# build-version: ${{ needs.setup.outputs.build-version }}
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}
# calc-deps-without-container:
# needs: [setup, generate-matrix]
# strategy:
# matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/calc-deps-without-container.yml@master
# with:
# if: ${{ matrix.config.compiler != 'GCC' }}
# os: ${{ matrix.config.os }}
# conan-remote: "kth"
# build-version: ${{ needs.setup.outputs.build-version }}
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}
# build-deps-with-container:
# needs: [calc-deps-with-container]
# strategy:
# matrix: ${{ fromJson(needs.calc-deps-with-container.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/build-deps-with-container.yml@master
# with:
# if: ${{ matrix.config.compiler == 'GCC' }}
# os: ${{ matrix.config.os }}
# image: "kthnode/gcc${{ matrix.config.version }}${{ matrix.config.docker_suffix }}"
# reference: ${{ matrix.config.reference }}
# conan-remote: "kth"
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}
# build-deps-without-container:
# needs: [calc-deps-without-container]
# strategy:
# matrix: ${{ fromJson(needs.calc-deps-without-container.outputs.matrix) }}
# name: ${{ matrix.config.name }}
# uses: k-nuth/ci-utils/.github/workflows/build-deps-without-container.yml@master
# with:
# if: ${{ matrix.config.compiler != 'GCC' }}
# os: ${{ matrix.config.os }}
# reference: ${{ matrix.config.reference }}
# conan-remote: "kth"
# secrets:
# conan-user: ${{ secrets.CONAN_LOGIN_USERNAME }}
# conan-password: ${{ secrets.CONAN_3_PASSWORD }}
build-with-container:
needs: [setup, generate-matrix]
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
name: ${{ matrix.config.name }}
uses: k-nuth/ci-utils/.github/workflows/build-with-container.yml@master
with:
if: ${{ matrix.config.compiler == 'GCC' }}
upload: ${{ github.event_name == 'push' }} # && needs.check.outputs.permitted == 'true'
os: ${{ matrix.config.os }}
image: "kthnode/gcc${{ matrix.config.version }}${{ matrix.config.docker_suffix }}"
conan-remote: "kth"
recipe-name: "domain"
compiler: ${{ matrix.config.compiler }}
compiler-version: ${{ matrix.config.version }}
version-file: "include/kth/domain/version.hpp"
build-version: "${{ needs.setup.outputs.build-version }}"
secrets:
CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }}
CONAN_PASSWORD: ${{ secrets.CONAN_3_PASSWORD }}
build-without-container:
needs: [setup, generate-matrix]
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
name: ${{ matrix.config.name }}
uses: k-nuth/ci-utils/.github/workflows/build-without-container.yml@master
with:
if: ${{ matrix.config.compiler != 'GCC' }}
upload: ${{ github.event_name == 'push' }} # && needs.check.outputs.permitted == 'true'
os: ${{ matrix.config.os }}
conan-remote: "kth"
recipe-name: "domain"
compiler: ${{ matrix.config.compiler }}
compiler-version: ${{ matrix.config.version }}
version-file: "include/kth/domain/version.hpp"
build-version: "${{ needs.setup.outputs.build-version }}"
secrets:
CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_LOGIN_USERNAME }}
CONAN_PASSWORD: ${{ secrets.CONAN_3_PASSWORD }}
static-checks:
# needs: wait-for-dependencies
name: Static Checks
if: github.ref == 'refs/heads/devX' ||
startsWith(github.ref, 'refs/heads/testci') ||
startsWith(github.ref, 'refs/heads/release') ||
startsWith(github.ref, 'refs/heads/hotfix')
runs-on: ubuntu-20.04
steps:
- name: Static Checks
shell: bash
run: |
echo ${{github.ref}}