Skip to content

Commit 65706e4

Browse files
authored
Refactor Build Workflow (#3)
1 parent c7309d7 commit 65706e4

File tree

2 files changed

+40
-179
lines changed

2 files changed

+40
-179
lines changed

.github/workflows/build.yml

+35-178
Original file line numberDiff line numberDiff line change
@@ -9,207 +9,64 @@ on:
99
permissions: read-all
1010

1111
jobs:
12-
build-linux-openssl:
12+
build:
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu, windows]
17+
tls: [schannel, openssl]
18+
shared: [on, off]
19+
exclude:
20+
- os: ubuntu
21+
tls: schannel
1322
permissions:
1423
contents: read
15-
name: Build Linux (OpenSSL)
16-
runs-on: ubuntu-latest
24+
name: Build
25+
runs-on: ${{ matrix.os }}-latest
1726
steps:
1827
- name: Harden Runner
1928
uses: step-security/harden-runner@9b0655f430fba8c7001d4e38f8d4306db5c6e0ab
2029
with:
2130
egress-policy: audit
22-
- name: Checkout repository
23-
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
24-
with:
25-
submodules: 'recursive'
26-
- name: Generate
27-
run: mkdir build && cd build && cmake -G 'Unix Makefiles' ..
28-
- name: Build
29-
run: cd build && cmake --build .
30-
- name: Upload
31-
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
32-
with:
33-
name: bin-linux-openssl
34-
path: |
35-
build/**/*.so
36-
build/**/quicreach
37-
- name: Install
38-
run: cd build && sudo cmake --install . --config Debug
39-
- name: quicreach outlook-evergreen.office.com
40-
run: /usr/local/lib/quicreach outlook-evergreen.office.com
41-
- name: quicreach www.cloudflare.com
42-
run: /usr/local/lib/quicreach www.cloudflare.com
43-
- name: quicreach www.google.com
44-
run: /usr/local/lib/quicreach www.google.com
45-
build-linux-openssl-static:
46-
permissions:
47-
contents: read
48-
name: Build Linux (OpenSSL) Static
49-
runs-on: ubuntu-latest
50-
steps:
51-
- name: Harden Runner
52-
uses: step-security/harden-runner@9b0655f430fba8c7001d4e38f8d4306db5c6e0ab
53-
with:
54-
egress-policy: audit
55-
- name: Checkout repository
56-
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
57-
with:
58-
submodules: 'recursive'
59-
- name: Generate
60-
run: mkdir build && cd build && cmake -G 'Unix Makefiles' -DQUIC_BUILD_SHARED=off ..
61-
- name: Build
62-
run: cd build && cmake --build .
63-
- name: Upload
64-
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
65-
with:
66-
name: bin-linux-openssl-static
67-
path: |
68-
build/**/quicreach
69-
- name: Install
70-
run: cd build && sudo cmake --install . --config Debug
71-
- name: quicreach outlook-evergreen.office.com
72-
run: /usr/local/lib/quicreach outlook-evergreen.office.com
73-
- name: quicreach www.cloudflare.com
74-
run: /usr/local/lib/quicreach www.cloudflare.com
75-
- name: quicreach www.google.com
76-
run: /usr/local/lib/quicreach www.google.com
77-
build-windows-openssl:
78-
permissions:
79-
contents: read
80-
name: Build Windows (OpenSSL)
81-
runs-on: windows-latest
82-
steps:
83-
- name: Checkout repository
84-
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
85-
with:
86-
submodules: 'recursive'
87-
- name: Install Perl
88-
uses: shogo82148/actions-setup-perl@20a7fcafc28850ff808cc2fa81e688fca4b3b47c
89-
with:
90-
perl-version: '5.34'
91-
- name: Install NASM
92-
uses: ilammy/setup-nasm@10788e307d96af7013172d66126322c70b22efb9
93-
- name: Generate
94-
run: mkdir build && cd build && cmake -G 'Visual Studio 17 2022' -A x64 -DQUIC_TLS=openssl ..
95-
- name: Build
96-
run: cd build && cmake --build .
97-
- name: Upload
98-
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
99-
with:
100-
name: bin-windows-openssl
101-
path: |
102-
build/**/*.dll
103-
build/**/quicreach.exe
104-
- name: Install
105-
run: cd build && cmake --install . --config Debug
106-
- name: quicreach outlook.office.com
107-
run: |
108-
& 'C:/Program Files/quicreach/lib/quicreach' outlook-evergreen.office.com
109-
- name: quicreach www.cloudflare.com
110-
run: |
111-
& 'C:/Program Files/quicreach/lib/quicreach' www.cloudflare.com
112-
- name: quicreach www.google.com
113-
run: |
114-
& 'C:/Program Files/quicreach/lib/quicreach' www.google.com
115-
build-windows-openssl-static:
116-
permissions:
117-
contents: read
118-
name: Build Windows (OpenSSL) Static
119-
runs-on: windows-latest
120-
steps:
12131
- name: Checkout repository
12232
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
12333
with:
12434
submodules: 'recursive'
12535
- name: Install Perl
36+
if: runner.os == 'Windows'
12637
uses: shogo82148/actions-setup-perl@20a7fcafc28850ff808cc2fa81e688fca4b3b47c
12738
with:
12839
perl-version: '5.34'
12940
- name: Install NASM
41+
if: runner.os == 'Windows'
13042
uses: ilammy/setup-nasm@10788e307d96af7013172d66126322c70b22efb9
131-
- name: Generate
132-
run: mkdir build && cd build && cmake -G 'Visual Studio 17 2022' -A x64 -DQUIC_BUILD_SHARED=off -DQUIC_TLS=openssl ..
133-
- name: Build
134-
run: cd build && cmake --build .
135-
- name: Upload
136-
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
137-
with:
138-
name: bin-windows-openssl
139-
path: |
140-
build/**/quicreach.exe
141-
- name: Install
142-
run: cd build && cmake --install . --config Debug
143-
- name: quicreach outlook.office.com
43+
- name: Build (Linux)
44+
if: runner.os == 'Linux'
14445
run: |
145-
& 'C:/Program Files/quicreach/lib/quicreach' outlook-evergreen.office.com
146-
- name: quicreach www.cloudflare.com
46+
mkdir build && cd build
47+
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DQUIC_TLS=${{ matrix.tls }} -DQUIC_BUILD_SHARED=${{ matrix.shared }} ..
48+
cmake --build .
49+
sudo cmake --install . --config Release
50+
- name: Build (Windows)
51+
if: runner.os == 'Windows'
14752
run: |
148-
& 'C:/Program Files/quicreach/lib/quicreach' www.cloudflare.com
149-
- name: quicreach www.google.com
150-
run: |
151-
& 'C:/Program Files/quicreach/lib/quicreach' www.google.com
152-
build-windows-schannel:
153-
permissions:
154-
contents: read
155-
name: Build Windows (Schannel)
156-
runs-on: windows-latest
157-
steps:
158-
- name: Checkout repository
159-
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
160-
with:
161-
submodules: 'recursive'
162-
- name: Generate
163-
run: mkdir build && cd build && cmake -G 'Visual Studio 17 2022' -A x64 ..
164-
- name: Build
165-
run: cd build && cmake --build .
53+
mkdir build && cd build
54+
cmake -G 'Visual Studio 17 2022' -A x64 -DQUIC_TLS=${{ matrix.tls }} -DQUIC_BUILD_SHARED=${{ matrix.shared }} ..
55+
cmake --build . --config Release
56+
cmake --install . --config Release
16657
- name: Upload
16758
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
16859
with:
169-
name: bin-windows-schannel
60+
name: bin-${{ matrix.os }}-${{ matrix.tls }}-shared_${{ matrix.shared }}
17061
path: |
62+
build/**/*.so
17163
build/**/*.dll
64+
build/**/quicreach
17265
build/**/quicreach.exe
173-
- name: Install
174-
run: cd build && cmake --install . --config Debug
175-
- name: quicreach outlook.office.com
176-
run: |
177-
& 'C:/Program Files/quicreach/lib/quicreach' outlook-evergreen.office.com
178-
- name: quicreach www.cloudflare.com
179-
run: |
180-
& 'C:/Program Files/quicreach/lib/quicreach' www.cloudflare.com
181-
- name: quicreach www.google.com
182-
run: |
183-
& 'C:/Program Files/quicreach/lib/quicreach' www.google.com
184-
build-windows-schannel-static:
185-
permissions:
186-
contents: read
187-
name: Build Windows (Schannel) Static
188-
runs-on: windows-latest
189-
steps:
190-
- name: Checkout repository
191-
uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
192-
with:
193-
submodules: 'recursive'
194-
- name: Generate
195-
run: mkdir build && cd build && cmake -G 'Visual Studio 17 2022' -A x64 -DQUIC_BUILD_SHARED=off ..
196-
- name: Build
197-
run: cd build && cmake --build .
198-
- name: Upload
199-
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
200-
with:
201-
name: bin-windows-schannel
202-
path: |
203-
build/**/quicreach.exe
204-
- name: Install
205-
run: cd build && cmake --install . --config Debug
206-
- name: quicreach outlook.office.com
207-
run: |
208-
& 'C:/Program Files/quicreach/lib/quicreach' outlook-evergreen.office.com
209-
- name: quicreach www.cloudflare.com
66+
- name: Test (Linux)
67+
if: runner.os == 'Linux'
68+
run: /usr/local/lib/quicreach outlook-evergreen.office.com,www.cloudflare.com,www.google.com --req-all --stats
69+
- name: Test (Windows)
70+
if: runner.os == 'Windows'
21071
run: |
211-
& 'C:/Program Files/quicreach/lib/quicreach' www.cloudflare.com
212-
- name: quicreach www.google.com
213-
run: |
214-
& 'C:/Program Files/quicreach/lib/quicreach' www.google.com
215-
72+
& 'C:/Program Files/quicreach/lib/quicreach' outlook-evergreen.office.com,www.cloudflare.com,www.google.com --req-all --stats

src/quicreach.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const MsQuicApi* MsQuic;
2525

2626
struct ReachConfig {
2727
bool PrintStatistics {false};
28+
bool RequireAll {false};
2829
std::vector<const char*> HostNames;
2930
uint16_t Port {443};
3031
MsQuicAlpn Alpn {"h3"};
@@ -42,6 +43,7 @@ bool ParseConfig(int argc, char **argv, ReachConfig& Config) {
4243
" -a, --alpn The ALPN to use for the handshake (def=h3)\n"
4344
" -h, --help Prints this help text\n"
4445
" -p, --port <port> The default UDP port to use\n"
46+
" -r, --req-all Require all hostnames to suceed\n"
4547
" -s, --stats Print connection statistics\n"
4648
" -u, --unsecure Allows unsecure connections\n"
4749
);
@@ -74,6 +76,8 @@ bool ParseConfig(int argc, char **argv, ReachConfig& Config) {
7476
Config.Port = (uint16_t)atoi(argv[i]);
7577
} else if (!strcmp(argv[i], "--stats") || !strcmp(argv[i], "-s")) {
7678
Config.PrintStatistics = true;
79+
} else if (!strcmp(argv[i], "--req-all") || !strcmp(argv[i], "-r")) {
80+
Config.RequireAll = true;
7781
} else if (!strcmp(argv[i], "--unsecure") || !strcmp(argv[i], "-u")) {
7882
Config.CredFlags |= QUIC_CREDENTIAL_FLAG_NO_CERTIFICATE_VALIDATION;
7983
}
@@ -154,7 +158,7 @@ bool TestReachability(const ReachConfig& Config) {
154158

155159
if (Config.PrintStatistics && ReachableCount > 1)
156160
printf("\n%u domains reachable\n", ReachableCount);
157-
return ReachableCount != 0;
161+
return Config.RequireAll ? ((size_t)ReachableCount == Config.HostNames.size()) : (ReachableCount != 0);
158162
}
159163

160164
int QUIC_CALL main(int argc, char **argv) {

0 commit comments

Comments
 (0)