-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (122 loc) · 7.19 KB
/
CI.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
name: rcon++ CI
on:
push:
paths:
- '**.h'
- '**.cmake'
- '**ci.yml'
- '**CMakeLists.txt'
pull_request:
paths:
- '**.h'
- '**.cmake'
- '**ci.yml'
- '**CMakeLists.txt'
permissions:
contents: read
jobs:
linux:
permissions:
contents: write
name: Linux ${{matrix.cfg.arch}} (${{matrix.cfg.cpp-version}})
runs-on: ${{matrix.cfg.os}}
strategy:
fail-fast: false # Don't fail everything if one fails. We want to test each OS/Compiler individually
matrix:
cfg:
- { arch: 'amd64', concurrency: 2, os: ubuntu-20.04, package: clang-10, cpp-version: clang++-10, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-11, cpp-version: clang++-11, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-12, cpp-version: clang++-12, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-13, cpp-version: clang++-13, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-14, cpp-version: clang++-14, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: clang-15, cpp-version: clang++-15, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-20.04, package: g++-9, cpp-version: g++-9, ctest: 'yes', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: g++-10, cpp-version: g++-10, ctest: 'no', cpack: 'yes', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: g++-11, cpp-version: g++-11, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: g++-12, cpp-version: g++-12, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
- { arch: 'amd64', concurrency: 2, os: ubuntu-22.04, package: g++-13, cpp-version: g++-13, ctest: 'no', cpack: 'no', downloadcpp: 'yes'}
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- name: Checkout rconpp
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install apt packages
run: sudo sed -i 's/azure\.//' /etc/apt/sources.list && sudo apt update && sudo apt-get install -y pkg-config
- name: Install C++ apt package
if: ${{ matrix.cfg.downloadcpp == 'yes' }}
run: sudo apt-get install -y ${{ matrix.cfg.package }}
- name: Generate CMake
run: cmake -B build
env:
CXX: ${{matrix.cfg.cpp-version}}
- name: Build Project
run: cmake --build build -j${{ matrix.cfg.concurrency }}
- name: Run unit tests
if: ${{ matrix.cfg.ctest == 'yes' }}
run: cd build && ctest -VV
env:
RCON_TESTING_IP: ${{secrets.RCON_TESTING_IP}}
RCON_TESTING_PORT: ${{secrets.RCON_TESTING_PORT}}
RCON_TESTING_PASSWORD: ${{secrets.RCON_TESTING_PASSWORD}}
- name: Package distributable
if: ${{ matrix.cfg.cpack == 'yes' }}
run: cd build && cpack --verbose
- name: Upload Binary (DEB)
if: ${{ matrix.cfg.cpack == 'yes' }}
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: "librconpp - Debian Package ${{matrix.cfg.arch}}"
path: '${{github.workspace}}/build/*.deb'
windows: # Windows x64 and x86 build matrix
permissions:
contents: write
strategy:
fail-fast: false # Don't cancel other matrix jobs if one fails
matrix:
cfg:
- { name: 'x64', arch: x64, config: Release, vs: '2019', os: 'windows-2019', vsv: '16', upload: true, options: '' }
- { name: 'x64', arch: x64, config: Debug, vs: '2019', os: 'windows-2019', vsv: '16', upload: true, options: '' }
- { name: 'x86', arch: x86, config: Release, vs: '2019', os: 'windows-2019', vsv: '16', upload: true, options: '-T host=x86 ' }
- { name: 'x86', arch: x86, config: Debug, vs: '2019', os: 'windows-2019', vsv: '16', upload: true, options: '-T host=x86 ' }
- { name: 'x64', arch: x64, config: Release, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '' }
- { name: 'x64', arch: x64, config: Debug, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '' }
- { name: 'x86', arch: x86, config: Release, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '-T host=x86' }
- { name: 'x86', arch: x86, config: Debug, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '-T host=x86' }
- { name: 'x64-Clang', arch: x64, config: Release, vs: '2022', os: 'windows-2022', vsv: '17', upload: false, options: '-T ClangCL' }
- { name: 'x64-Clang', arch: x64, config: Debug, vs: '2022', os: 'windows-2022', vsv: '17', upload: false, options: '-T ClangCL' }
name: "Windows ${{matrix.cfg.name}}-${{matrix.cfg.config}}-vs${{matrix.cfg.vs}}"
runs-on: ${{matrix.cfg.os}}
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
with:
egress-policy: audit
- name: Checkout rconpp
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: main
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1
- name: Install chocolatey packages ${{ matrix.cfg.arch}}
uses: seanmiddleditch/gha-setup-ninja@8b297075da4cd2a5f1fd21fe011b499edf06e9d2 # master
- name: Generate CMake (x64)
if: ${{ matrix.cfg.arch == 'x64' }}
run: mkdir main/build && cd main/build && cmake -G "Visual Studio ${{matrix.cfg.vsv}} ${{matrix.cfg.vs}}" ${{matrix.cfg.options}} ..
- name: Generate CMake (x86)
if: ${{ matrix.cfg.arch == 'x86' }}
run: mkdir main/build && cd main/build && cmake -DCMAKE_TOOLCHAIN_FILE="cmake\Win32Toolchain.cmake" -G "Visual Studio ${{matrix.cfg.vsv}} ${{matrix.cfg.vs}}" -A Win32 ${{matrix.cfg.options}} ..
- name: Build Project
run: cmake --build main/build --target rconpp --config ${{matrix.cfg.config}} --parallel 2
- name: Move debug files for packaging
if: ${{ matrix.cfg.config == 'Debug' }}
run: xcopy main\build\Debug\* main\build\Release\ /s /q
- name: Package distributable
run: cd main/build && cpack --verbose
- name: Upload Binary
if: ${{ matrix.cfg.upload }}
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: "librconpp - Windows ${{matrix.cfg.name}}-${{matrix.cfg.config}}-vs${{matrix.cfg.vs}}"
path: '${{github.workspace}}/main/build/*.zip'