This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (72 loc) · 2.37 KB
/
compile-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
name: C++ compile tester
on:
pull_request:
branches:
- main
push:
branches:
- main
release:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install C++ compilers
run: |
sudo apt install -y g++
sudo apt install -y clang
sudo apt install -y llvm
- name: Compile C++ code
run: |
success=false
# Compile with different C++ standards
if g++ -std=c++03 -Wall -Wextra -Werror -pedantic -c password.cpp -o gcc03; then
success=true
fi
if g++ -std=c++11 -Wall -Wextra -Werror -pedantic -c password.cpp -o gcc11; then
success=true
fi
if g++ -std=c++14 -Wall -Wextra -Werror -pedantic -c password.cpp -o gcc14; then
success=true
fi
if g++ -std=c++17 -Wall -Wextra -Werror -pedantic -c password.cpp -o gcc17; then
success=true
fi
if g++ -std=c++20 -Wall -Wextra -Werror -pedantic -c password.cpp -o gcc20; then
success=true
fi
if g++ -std=c++23 -Wall -Wextra -Werror -pedantic -c password.cpp -o gcc23; then
success=true
fi
if clang++ -std=c++03 -Wall -Wextra -Werror -pedantic -c password.cpp -o clang03; then
success=true
fi
if clang++ -std=c++11 -Wall -Wextra -Werror -pedantic -c password.cpp -o clang11; then
success=true
fi
if clang++ -std=c++14 -Wall -Wextra -Werror -pedantic -c password.cpp -o clang14; then
success=true
fi
if clang++ -std=c++17 -Wall -Wextra -Werror -pedantic -c password.cpp -o clang17; then
success=true
fi
if clang++ -std=c++20 -Wall -Wextra -Werror -pedantic -c password.cpp -o clang20; then
success=true
fi
if clang++ -std=c++2b -Wall -Wextra -Werror -pedantic -c password.cpp -o clang23; then
success=true
fi
# Exit with a non-zero status if none of the compilations succeeded
if ! $success; then
exit 1
fi
- name: Upload build artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: .