-
Notifications
You must be signed in to change notification settings - Fork 9
228 lines (189 loc) · 7.08 KB
/
tests.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
228
# This is a basic workflow to help you get started with Actions
name: Automated Tests
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
tags:
- "v*"
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
part_tests:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v3
if: ${{ github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.ref }}
submodules: true
- name: Cache packages
uses: actions/cache@v3.0.11
id: cache-pkgs
with:
path: "packages"
key: "pkgs-1_0_1-test"
restore-keys: "pkgs-1_0_1-test"
- name: Setup cache dir
if: ${{ ! steps.cache-valgrind.outputs.cache-hit }}
run: mkdir -p packages/partial
- name: Install packages
run: |
sudo apt-get update
sudo apt-get -o Dir::Cache::Archives=`pwd`/packages install libelf-dev gcc-avr avr-libc libglew-dev freeglut3-dev libsdl2-dev lcov xvfb mesa-utils
- name: Cache permissions
run: sudo chmod -R 744 packages
- name: Prepare CMake build
run: mkdir ${{ runner.workspace }}/MK404/build && cd ${{ runner.workspace }}/MK404/build && cmake -DENABLE_GCOV=1 -DSANITY_TESTS=1 -DRUNNER_ENV=1 ..
- name: Build Einsy
run: cd ${{ runner.workspace }}/MK404/build && make -j2
- name: Run tests
id: test_pts
continue-on-error: true
run: |
cd ${{ runner.workspace }}/MK404/build
make Test_Parts -j1
- run: cd ${{ runner.workspace }}/MK404/build && tar -zcvf snaps_core.tar.gz tests/snaps/
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: Report-1
path: |
${{ runner.workspace }}/MK404/build/snaps_core.tar.gz
# ${{ runner.workspace }}/MK404/build/Coverage.tar.gz
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: Coverage
path: |
${{ runner.workspace }}/MK404/build/parts.info
${{ runner.workspace }}/MK404/build/CMakeFiles/MK404.dir/
- name: Report failure
if: steps.test_pts.outcome == 'failure'
run: test -n ""
# - name: Comment on PR
# if: ${{ github.event.pull_request }}
# uses: marocchino/sticky-pull-request-comment@v1
# with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# path: ${{ runner.workspace }}/MK404/build/summary.txt
ext1_tests:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v3
if: ${{ github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.ref }}
submodules: true
- name: Cache packages
uses: actions/cache@v3.0.11
id: cache-pkgs
with:
path: "packages"
key: "pkgs-1_0_1-test"
restore-keys: "pkgs-1_0_1-test"
- name: Setup cache dir
if: ${{ ! steps.cache-valgrind.outputs.cache-hit }}
run: mkdir -p packages/partial
- name: Install packages
run: |
sudo apt-get update
sudo apt-get -o Dir::Cache::Archives=`pwd`/packages install libelf-dev gcc-avr avr-libc libglew-dev freeglut3-dev libsdl2-dev lcov xvfb mesa-utils
- name: Cache permissions
run: sudo chmod -R 744 packages
- name: Prepare CMake build
run: mkdir ${{ runner.workspace }}/MK404/build && cd ${{ runner.workspace }}/MK404/build && cmake -DENABLE_GCOV=1 -DSANITY_TESTS=1 -DRUNNER_ENV=1 ..
- name: Build Einsy
run: cd ${{ runner.workspace }}/MK404/build && make -j2
- name: Run tests
id: tests_ext
continue-on-error: true
run: |
cd ${{ runner.workspace }}/MK404/build
make Test_ext1 -j1
- run: cd ${{ runner.workspace }}/MK404/build && tar -zcvf snaps_ext1.tar.gz tests/snaps/
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: Report-2
path: |
${{ runner.workspace }}/MK404/build/snaps_ext1.tar.gz
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: Coverage2
path: |
${{ runner.workspace }}/MK404/build/ext1.info
${{ runner.workspace }}/MK404/build/CMakeFiles/MK404.dir/
- name: Report failure
if: steps.tests_ext.outcome == 'failure'
run: echo ${{ steps.tests_ext.outcome }} && test -n ""
Upload_Coverage:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
needs: [ext1_tests, part_tests]
steps:
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v3
if: ${{ github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.ref }}
submodules: true
- name: Retrieve coverage reports
uses: actions/download-artifact@v4.1.7
with:
name: Coverage
path: parts
- name: Retrieve coverage reports
uses: actions/download-artifact@v4.1.7
with:
name: Coverage2
path: ext1
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
# Comma-separated list of files to upload
files: ./parts/parts.info,./ext1/ext1.info
# Specify whether or not CI build should fail if Codecov runs into an error during upload
fail_ci_if_error: true
# Comma-separated list, see the README for options and their usage
# functionalities: # optional
# Specify whether the Codecov output should be verbose
verbose: true