-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (75 loc) · 2.86 KB
/
test.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
name: Test CI
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
jobs:
test:
name: Run Tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- uses: actions/checkout@v4
name: Checkout OOPetris main repo
with:
fetch-depth: "0"
repository: OpenBrickProtocolFoundation/oopetris
ref: main
path: ./oopetris
submodules: false
- name: Setup Clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install libc++-18* libc++abi*18* llvm-18 -y
echo "CC=clang-18" >> "$GITHUB_ENV"
echo "CXX=clang++-18" >> "$GITHUB_ENV"
# NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything!
- name: Setup meson
run: |
sudo pip install meson --break-system-packages
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install ninja-build valgrind gcovr libcriterion-dev libreadline-dev -y
- name: Configure
run: |
cd oopetris
meson setup build -Db_coverage=true -Dbuildtype=debugoptimized -Ddefault_library=shared -Dclang_libcpp=enabled -Donly_build_libs=true -Dprefix=/usr
- name: Build and install Libs
run: |
cd oopetris
sudo meson install -C build
- name: Build Wrapper
run: |
meson setup build -Db_coverage=true -Dbuildtype=debugoptimized -Ddefault_library=shared -Dclang_libcpp=enabled -Dtests=true -Dexample=true -Dprefix=/usr
meson compile -C build
- name: Test Wrapper
run: |
meson test -C build --verbose
ninja coverage -C build
- name: Create Coverage Report
uses: insightsengineering/coverage-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: ./build/meson-logs/coverage.xml
fail: true
publish: true
coverage-summary-title: "Code Coverage Summary"
togglable-report: true
- name: Upload test coverage artifacts
uses: actions/upload-artifact@v4
with:
name: Tests coverage artifacts
path: |
./build/meson-logs/coverage.xml
./build/meson-logs/coveragereport/
- name: Test for leaks with valgrind (Linux)
run: |
valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ./build/example/example r ./tests/files/correct.rec
valgrind --tool=memcheck --leak-check=full --error-exitcode=1 cat ./tests/files/example.rec_text | ./build/example/example w ./test.rec
valgrind --tool=memcheck --leak-check=full --error-exitcode=1 ./build/example/example r ./test.rec