-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (158 loc) · 5.89 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
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
name: build & test (clang, gcc, MSVC)
on:
push:
branches: [ "master", "dev" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "master", "dev" ]
paths-ignore:
- '**.md'
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu Latest gcc",
os: ubuntu-latest,
cmake-preset: gcc-release,
cmake_vars: "",
asio_type: "standalone",
artifacts-path-postfix: ""
}
- {
name: "Ubuntu Latest clang",
os: ubuntu-latest,
cmake-preset: clang-release,
cmake_vars: "",
asio_type: "standalone",
artifacts-path-postfix: ""
}
- {
name: "Windows Latest MSVC",
os: windows-latest,
cmake-preset: msvc-release,
cmake_vars: "",
asio_type: "standalone",
artifacts-path-postfix: "Release"
}
- {
name: "Ubuntu Latest clang (Boost.Asio)",
os: ubuntu-latest,
cmake-preset: clang-release,
asio_type: "boost",
cmake_vars: "-DASYNCGI_USE_BOOST_ASIO=ON -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake",
artifacts-path-postfix: ""
}
- {
name: "Windows Latest MSVC (Boost.Asio)",
os: windows-latest,
cmake-preset: msvc-release,
asio_type: "boost",
cmake_vars: "-DASYNCGI_USE_BOOST_ASIO=ON -DCMAKE_GENERATOR_PLATFORM=x64 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DCMAKE_TOOLCHAIN_FILE='vcpkg/scripts/buildsystems/vcpkg.cmake'",
artifacts-path-postfix: "Release"
}
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Install vcpkg
uses: lukka/run-vcpkg@v10
with:
vcpkgGitCommitId: 31a159c1cae2bf905299085d9ef01bdfea0ca7b8
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DENABLE_EXAMPLES=ON ${{ matrix.config.cmake_vars }} --preset="${{ matrix.config.cmake-preset }}"
- name: Build
run: cmake --build ${{github.workspace}}/build --config Release
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: asyncgi-examples-${{ matrix.config.os }}-${{ matrix.config.asio_type }}-asio
path: build/examples/${{ matrix.config.artifacts-path-postfix }}
- name: Upload build test artifact
uses: actions/upload-artifact@v3
with:
name: asyncgi-test-examples-${{ matrix.config.os }}-${{ matrix.config.asio_type }}-asio
path: build/test_examples/${{ matrix.config.artifacts-path-postfix }}
functional_tests:
name: Functional testing (${{ matrix.config.name }} ${{ matrix.asio_type }}-asio)
needs: build
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
asio_type: [ "standalone", "boost" ]
config:
- {
name: "Windows",
os: "windows-latest",
lunchtoast_exec: "lunchtoast.exe",
shell_command: -shell="msys2 -c",
tags: -skip=linux,
nginx_exec: "c:/tools/nginx-1.25.3/nginx.exe",
nginx_cfg: "nginx_windows.conf"
}
- {
name: "Linux",
os: "ubuntu-latest",
lunchtoast_exec: "lunchtoast",
shell_command: "",
tags: "",
nginx_exec: "nginx",
nginx_cfg: "nginx_linux.conf"
}
steps:
- name: Git checkout
uses: actions/checkout@v3
- if: matrix.config.name == 'Windows'
name: Install MSYS2
uses: msys2/setup-msys2@v2
with:
path-type: inherit
- name: Download lunchtoast
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 asyncgi examples build
uses: actions/download-artifact@v3
with:
name: asyncgi-examples-${{ matrix.config.os }}-${{ matrix.asio_type }}-asio
path: build/examples
- name: Download asyncgi test_examples build
id: pre_launch_tests
uses: actions/download-artifact@v3
with:
name: asyncgi-test-examples-${{ matrix.config.os }}-${{ matrix.asio_type }}-asio
path: build/test_examples
- name: Set artifacts execute permissions
if: matrix.config.name == 'Linux'
shell: sh
working-directory: ${{github.workspace}}/build/
run: chmod +x examples/example_* && chmod +x test_examples/test_*
- name: Make temp dir for NGINX
run: mkdir ${{github.workspace}}/temp
- name: Launch tests
uses: BerniWittmann/background-server-action@v1
with:
command: lunchtoast/lunchtoast functional_tests ${{ matrix.config.shell_command }} ${{ matrix.config.tags }} -collectFailedTests=failed_tests
start: ${{ matrix.config.nginx_exec }} -c '${{github.workspace}}'/functional_tests/${{ matrix.config.nginx_cfg }}
- name: Upload failed tests
if: failure() && steps.launch_tests.outcome != 'success' && steps.pre_launch_tests.outcome == 'success'
uses: actions/upload-artifact@v3
with:
name: asyncgi-failed-tests-${{ matrix.config.os }}
path: failed_tests