-
Notifications
You must be signed in to change notification settings - Fork 30
157 lines (140 loc) · 5.53 KB
/
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: CI
on:
pull_request:
schedule:
- cron: '0 20 * * *' # Every day at 12pm PST (UTC-8)
env:
BUILD_TYPE: Release
MOUNT: /azure-osconfig
REGISTRY: ghcr.io
jobs:
create-ci-matrix:
name: Build CI distro matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.get-matrix.outputs.matrix }}
steps:
- name: Get matrix
id: get-matrix
run: |
matrix="$(cat <<'EOL'
[
{ "name": "almalinux-9", "arch": "amd64", "tag": "latest" },
{ "name": "amazonlinux-2", "arch": "amd64", "tag": "latest" },
{ "name": "centos-7", "arch": "amd64", "tag": "latest" },
{ "name": "centos-8", "arch": "amd64", "tag": "latest" },
{ "name": "debian-10", "arch": "amd64", "tag": "latest" },
{ "name": "debian-11", "arch": "amd64", "tag": "latest" },
{ "name": "debian-12", "arch": "amd64", "tag": "latest" },
{ "name": "mariner-2", "arch": "amd64", "tag": "latest" },
{ "name": "oraclelinux-7", "arch": "amd64", "tag": "latest" },
{ "name": "oraclelinux-8", "arch": "amd64", "tag": "latest" },
{ "name": "rhel-7", "arch": "amd64", "tag": "latest" },
{ "name": "rhel-8", "arch": "amd64", "tag": "latest" },
{ "name": "rhel-9", "arch": "amd64", "tag": "latest" },
{ "name": "sles-15", "arch": "amd64", "tag": "latest" },
{ "name": "ubuntu-20.04", "arch": "amd64", "tag": "latest" },
{ "name": "ubuntu-22.04", "arch": "amd64", "tag": "latest" }
]
EOL
)"
# Skip ARM64 CI builds for now
#
# arm64Targets="$(cat <<'EOL'
# [
# { "name": "debian-10", "arch": "arm64", "tag": "sha-c689eee" },
# { "name": "debian-11", "arch": "arm64", "tag": "sha-c689eee" },
# { "name": "debian-12", "arch": "arm64", "tag": "sha-db3d4c8" },
# { "name": "ubuntu-20.04", "arch": "arm64", "tag": "sha-c689eee" },
# { "name": "ubuntu-22.04", "arch": "arm64", "tag": "sha-db3d4c8" }
# ]
# EOL
# )"
#
# Add arm64 distros only on scheduled runs to prevent long CI times for PRs
# if [ "${{ github.event_name }}" == "schedule" ]; then
# matrix=$(jq --argjson arm64Targets "$arm64Targets" '. += $arm64Targets' <<< "$matrix")
# fi
echo Distros to perform CI on: $matrix
echo matrix=$matrix >> $GITHUB_OUTPUT
unit-test:
name: Unit test
needs: create-ci-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.create-ci-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
clean: true
- name: Docker login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
# - name: Setup QEMU
# if: ${{ matrix.target.arch != 'amd64' }}
# uses: docker/setup-qemu-action@v3
- name: Run container
id: container
uses: ./.github/actions/container-run
with:
registry: ${{ env.REGISTRY }}
container: azure/azure-osconfig/${{ matrix.target.name }}-${{ matrix.target.arch }}
mount: ${{ github.workspace }}:${{ env.MOUNT }}
tag: ${{ matrix.target.tag }}
- name: Generate build
uses: ./.github/actions/container-exec
with:
container: ${{ steps.container.outputs.id }}
cmd: |
mkdir build && cd build
cmake ../src -DCMAKE_C_COMPILER="/usr/bin/gcc" -DCMAKE_CXX_COMPILER="/usr/bin/g++" -DCMAKE_build-type=${{ env.BUILD_TYPE }} -Duse_prov_client=ON -Dhsm_type_symm_key=ON -DCOMPILE_WITH_STRICTNESS=ON -DBUILD_TESTS=ON -DBUILD_SAMPLES=ON -DBUILD_ADAPTERS=ON -Duse_default_uuid=ON
- name: Build azure-osconfig
uses: ./.github/actions/container-exec
with:
container: ${{ steps.container.outputs.id }}
working-directory: ${{ env.MOUNT }}/build
cmd: cmake --build . --config ${{ env.BUILD_TYPE }} --parallel
- name: Run ctest
uses: ./.github/actions/container-exec
with:
container: ${{ steps.container.outputs.id }}
working-directory: ${{ env.MOUNT }}/build
cmd: ctest --verbose > ../${{ matrix.target.name }}-${{ matrix.target.arch }}.log
- name: Generate test report
uses: ./.github/actions/gtest-xml
if: success() || failure()
with:
path: ./build/gtest-output
output: ${{ matrix.target.name }}-${{ matrix.target.arch }}.xml
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: unit-test-${{ matrix.target.name }}-${{ matrix.target.arch }}
path: |
${{ matrix.target.name }}-${{ matrix.target.arch }}.log
${{ matrix.target.name }}-${{ matrix.target.arch }}.xml
report:
name: Report
needs: unit-test
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
if: always()
steps:
- name: Download Test Report Artifacts
uses: actions/download-artifact@v4
with:
path: ci-test
pattern: 'unit-test-*'
merge-multiple: true
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: 'ci-test/*.xml'