-
Notifications
You must be signed in to change notification settings - Fork 2
145 lines (135 loc) · 4.96 KB
/
build_and_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
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
name: build & test (clang, gcc, MSVC)
on:
workflow_dispatch:
push:
branches: [ "master", "dev", "v3" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "master", "dev", "v3" ]
paths-ignore:
- '**.md'
jobs:
build:
name: ${{ matrix.config.name }} (nameof = ${{ matrix.use_nameof }})
runs-on: ${{ matrix.config.os }}
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
strategy:
fail-fast: false
matrix:
use_nameof: ["ON", "OFF"]
config:
- {
name: "Ubuntu Latest gcc",
os: ubuntu-latest,
cmake-preset: gcc-release,
artifacts-path: ""
}
- {
name: "Ubuntu Latest clang",
os: ubuntu-latest,
cmake-preset: clang-release,
artifacts-path: ""
}
- {
name: "Windows Latest MSVC",
os: windows-latest,
cmake-preset: msvc-release,
artifacts-path: "/Release"
}
steps:
- name: Install ninja (Windows)
if: matrix.config.os == 'windows-latest'
run: choco install ninja
- name: Install ninja (Linux)
if: matrix.config.os == 'ubuntu-latest'
run: sudo apt install ninja-build
- uses: actions/checkout@v4
- uses: rui314/setup-mold@v1
- uses: hendrikmuhs/ccache-action@v1.2
- uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=ON -DENABLE_TESTS_CPP20=ON -DENABLE_TESTS_STATIC_REFL=ON -DENABLE_EXAMPLES=ON -DENABLE_EXAMPLES_STATIC_REFL=ON -DFIGCONE_USE_NAMEOF=${{ matrix.use_nameof }} -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }}"
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: figcone-examples-${{ matrix.config.os }}-nameof-${{ matrix.use_nameof }}
path: |
${{github.workspace}}/build/examples${{ matrix.config.artifacts-path }}
${{github.workspace}}/build/examples_static_refl${{ matrix.config.artifacts-path }}
functional_tests:
name: Functional testing (${{ matrix.config.name }}, nameof = ${{ matrix.use_nameof }})
needs: build
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
use_nameof: [ "ON", "OFF" ]
config:
- {
name: "Windows",
os: "windows-latest",
lunchtoast_exec: "lunchtoast.exe",
shell_command: -shell="msys2 -c",
}
- {
name: "Linux",
os: "ubuntu-latest",
lunchtoast_exec: "lunchtoast",
shell_command: "",
}
steps:
- uses: actions/checkout@v3
- if: matrix.config.name == 'Windows'
uses: msys2/setup-msys2@v2
with:
path-type: inherit
- uses: robinraju/release-downloader@v1.7
with:
repository: "kamchatka-volcano/lunchtoast"
latest: true
filename: ${{ matrix.config.lunchtoast_exec }}
out-file-path: "lunchtoast/"
- name: Set lunchtoast execute permissions
if: matrix.config.name == 'Linux'
shell: sh
working-directory: ${{github.workspace}}/lunchtoast
run: chmod +x lunchtoast
- name: Download figcone examples build
id: pre_launch_tests
uses: actions/download-artifact@v3
with:
name: figcone-examples-${{ matrix.config.os }}-nameof-${{ matrix.use_nameof }}
path: build/
- name: Fix artifacts paths on Windows
if: matrix.config.name == 'Windows'
working-directory: ${{github.workspace}}/build/
shell: sh
run: mv examples_static_refl/Release/* examples_static_refl/ && mv examples/Release/* examples/ || true
- name: Set artifacts execute permissions
if: matrix.config.name == 'Linux'
shell: sh
working-directory: ${{github.workspace}}/build/examples
run: chmod +x ex* && chmod +x demo_*
- name: Set artifacts execute permissions
if: matrix.config.name == 'Linux'
shell: sh
working-directory: ${{github.workspace}}/build/examples_static_refl
run: chmod +x ex* && chmod +x demo_*
- name: Launch tests
id: launch_tests
working-directory: ${{github.workspace}}
run: lunchtoast/lunchtoast functional_tests ${{ matrix.config.shell_command }} -collectFailedTests=failed_tests
- name: Upload failed tests
if: failure() && steps.launch_tests.outcome != 'success' && steps.pre_launch_tests.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: figcone-failed-tests-${{ matrix.config.os }}-nameof-${{ matrix.use_nameof }}
path: failed_tests