-
Notifications
You must be signed in to change notification settings - Fork 3
215 lines (190 loc) · 6.9 KB
/
CpuUsage-Tests-Matrix.yml
File metadata and controls
215 lines (190 loc) · 6.9 KB
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
name: CPU Usage Tests Matrix
on:
workflow_dispatch:
push:
branches: [ "master" ]
defaults:
run:
shell: bash
jobs:
TestCpuUsageOnVm:
name: On VM
strategy:
fail-fast: false
matrix:
host: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
os:
- 'x64-debian-10'
- 'x64-debian-11'
- 'x64-debian-12'
- 'x64-debian-13'
- 'x64-ubuntu-22.04'
- 'x64-ubuntu-24.04'
- 'arm64-debian-10'
- 'arm64-debian-11'
- 'arm64-debian-12'
- 'arm64-debian-13'
- 'arm64-ubuntu-14.04'
- 'arm64-ubuntu-16.04'
- 'arm64-ubuntu-18.04'
- 'arm64-ubuntu-20.04'
- 'arm64-ubuntu-22.04'
- 'arm64-ubuntu-24.04'
- 'armel-debian-8'
- 'armel-debian-9'
- 'armel-debian-10'
- 'armel-debian-11'
- 'armhf-debian-8'
- 'armhf-debian-9'
- 'armhf-debian-10'
- 'armhf-debian-11'
- 'armhf-debian-12'
- 'armhf-ubuntu-14.04'
- 'armhf-ubuntu-16.04'
- 'armhf-ubuntu-18.04'
- 'armhf-ubuntu-20.04'
- 'armhf-ubuntu-22.04'
- 'armhf-ubuntu-24.04'
- 'i386-debian-10'
- 'i386-debian-11'
- 'i386-debian-12'
runs-on: ${{ matrix.host }}
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Bootstrap (timeout and try-and-retry)
run: |
script=https://raw.githubusercontent.com/devizer/test-and-build/master/install-build-tools-bundle.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash > /dev/null
dotnet --info
Say "Installing timeout"
try-and-retry sudo apt-get update -qq;
try-and-retry sudo apt-get install bsdutils -y -qq;
timeout --version
- name: Build Tests
run: |
set -ue; set -o pipefail
cd Universe.CpuUsage.Tests
Reset-Target-Framework -fw net48
time try-and-retry dotnet build -c Release -f net48 -o "$HOME/Artifacts" >/dev/null
- name: Pull VM
run: |
set -ue; set -o pipefail
docker version
try-and-retry docker pull "devizervlad/crossplatform-pipeline:${{ matrix.os }}"
- name: Run Tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 12
max_attempts: 3
shell: bash
retry_wait_seconds: 1
on_retry_command: 'docker rm -f VM 2>/dev/null || true'
command: |
set -ue; set -o pipefail
cat << 'EOF' > "$HOME/Artifacts/lets-rock.sh"
Say "STARTING TESTS";
free -m;
nunit3-console --inprocess --workers=1 Universe.CpuUsage.Tests.dll | tee /job/PRECISION.LOG;
Say "TESTS COMPLETED"
EOF
cat "$HOME/Artifacts/lets-rock.sh"
timeout 666 docker run --privileged -e VM_MEM=1000M -e VM_CPUS=2 -e QEMU_TCG_ACCELERATOR=tcg --name VM --hostname VM --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined -t \
-v "$HOME/Artifacts":/job \
"devizervlad/crossplatform-pipeline:${{ matrix.os }}" \
bash -e lets-rock.sh
- name: PREPARE Artifact
run: |
sudo chown -R $(whoami) $HOME/Artifacts
cp $HOME/Artifacts/PRECISION.LOG /tmp/0
# sed '0,/Show_Precision_Histogram/d' - it exclides matching line
cat /tmp/0 | sed -n '/Show_Precision_Histogram/,$p' > /tmp/1
tac /tmp/1 > /tmp/2
cat /tmp/2 | sed -n '/Show_Precision_Histogram/,$p' > /tmp/3
tac /tmp/3 > $HOME/Artifacts/PRECISION.LOG
mkdir -p "${{ github.workspace }}/Artifact"
cp -f $HOME/Artifacts/PRECISION.LOG "${{ github.workspace }}/Artifact/PRECISION on ${{ matrix.os }} at ${{ matrix.host }}.LOG"
cat $HOME/Artifacts/PRECISION.LOG
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: 'Precision ${{ matrix.os }} at ${{ matrix.host }}'
path: '${{ github.workspace }}/Artifact'
TestCpuUsageonHost:
name: On Host
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
- os: windows-2022
- os: windows-2019
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: ubuntu-24.04
- os: macos-13
- os: macos-14
- os: macos-15
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Environment
run: 'printenv | sort'
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0
- name: .NET Info
run: |
script=https://raw.githubusercontent.com/devizer/test-and-build/master/install-build-tools-bundle.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash > /dev/null
dotnet --info
- name: TEST full (and build)
run: |
set -eu;
Say ".NET SDK LIST"
dotnet --list-sdks
if [[ "$(uname -s)" == Linux ]]; then
Say "Linux Kernel: [$(uname -r 2>/dev/null)]"
fi
TARGET_FRAMEWORKS_TEST="${TARGET_FRAMEWORKS_TEST:-net8.0}"
cd Universe.CpuUsage.Tests
Say "Building $TARGET_FRAMEWORKS_TEST"
sed -i -E 's|<TargetFrameworks>.*</TargetFrameworks>|<TargetFrameworks>'$TARGET_FRAMEWORKS_TEST'</TargetFrameworks>|' *.csproj
time try-and-retry dotnet build -c Release -f $TARGET_FRAMEWORKS_TEST >/dev/null 2>&1
Say "Testing"
dotnet test --no-build -c Release -f $TARGET_FRAMEWORKS_TEST
- name: SHOW Precision Histogram
run: |
set -eu;
Say "Linux Kernel: [$(uname -r 2>/dev/null)]"
cd Universe.CpuUsage.Tests
TARGET_FRAMEWORKS_TEST="${TARGET_FRAMEWORKS_TEST:-net8.0}"
mkdir -p ../Artifact
dotnet test --no-build -c Release -f $TARGET_FRAMEWORKS_TEST --filter "Name ~ Show_Precision_Histogram" | tee "../Artifact/PRECISION on ${{ matrix.os }}.LOG" &
- name: Upload artifacts [${{ env.THEARTIFACTS_NATIVE }}]
uses: actions/upload-artifact@v4
if: always()
with:
name: 'Precision ${{ matrix.os }}'
path: '${{ github.workspace }}/Artifact'
Combine:
name: Combine results in a single Artifact
needs: [TestCpuUsageonHost, TestCpuUsageOnVm]
if: always()
runs-on: ubuntu-latest
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
pattern: '**'
path: "${{ runner.temp }}/Combined"
merge-multiple: true
- name: Show Download Structure
run: 'sudo apt-get update -qq; sudo apt-get install tree -y -qq; tree $RUNNER_TEMP'
- name: Upload Combined System Info
uses: actions/upload-artifact@v4
with:
name: 'Combined CPU Usage Tests'
path: "${{ runner.temp }}/Combined"