-
Notifications
You must be signed in to change notification settings - Fork 4
131 lines (118 loc) · 3.72 KB
/
cpp.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
name: C++
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
run-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Ubuntu-20.04 is being used here on purpose instead of ubuntu-latest due to a bug with clang and libstdc++
# https://github.com/actions/runner-images/issues/8659
os: [ubuntu-20.04, windows-latest, macos-13]
build_type: [Release]
cpp_compiler: [g++, clang++, cl]
exclude:
- os: windows-latest
cpp_compiler: clang++
- os: ubuntu-20.04
cpp_compiler: cl
- os: macos-13
cpp_compiler: cl
steps:
- uses: actions/checkout@v3
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/cpp-tests/build" >> "$GITHUB_OUTPUT"
echo "build-source-dir=${{ github.workspace }}/cpp-tests" >> "$GITHUB_OUTPUT"
- name: Install additional dependencies
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update && sudo apt install -y valgrind
fi
- name: Configure CMake
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ] && [ "${{ matrix.cpp_compiler }}" == "g++" ]; then
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ steps.strings.outputs.build-source-dir }}
-G "MinGW Makefiles"
elif
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ steps.strings.outputs.build-source-dir }}
fi
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Run tests
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ matrix.build_type }}
build-scaffolding-lib:
runs-on: ubuntu-latest
container:
image: ghcr.io/nordsecurity/uniffi-bindgen-cpp-test-runner:v0.3.0
steps:
- uses: actions/checkout@v3
- name: Build scaffolding library
shell: bash
env:
# Github sets HOME to /github/home and breaks dependencies in Docker image..
# https://github.com/actions/runner/issues/863
HOME: /root
run: |
source ~/.bashrc
./build_scaffolding_lib.sh
- uses: actions/upload-artifact@v3
with:
name: scaffolding_lib
path: cpp-tests/build/libuniffi_fixtures.so
test-scaffolding-go:
runs-on: ubuntu-latest
container:
image: ghcr.io/nordsecurity/uniffi-bindgen-cpp-test-runner:v0.3.0
needs: build-scaffolding-lib
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: scaffolding_lib
path: cpp-tests/build/
- name: Test scaffolding Go
shell: bash
env:
HOME: /root
run: |
source ~/.bashrc
./test_scaffolding_go.sh
test-scaffolding-cs:
runs-on: ubuntu-latest
container:
image: ghcr.io/nordsecurity/uniffi-bindgen-cs-test-runner:v0.1.0
needs: build-scaffolding-lib
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: scaffolding_lib
path: cpp-tests/build/
- name: Test scaffolding C#
shell: bash
env:
HOME: /root
run: |
source ~/.bashrc
./test_scaffolding_cs.sh