-
Notifications
You must be signed in to change notification settings - Fork 1
209 lines (174 loc) · 5.82 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: ekizu CI
on:
push:
branches:
- main
- dev
paths:
- "**ci.yml"
- "**.hpp"
- "**.cpp"
- "**CMakeLists.txt"
pull_request:
branches:
- main
- dev
paths:
- "**ci.yml"
- "**.hpp"
- "**.cpp"
- "**CMakeLists.txt"
env:
BRANCH_NAME: ${{ github.ref == 'refs/heads/dev' && 'dev' || 'main' }}
PRERELEASE: ${{ github.ref == 'refs/heads/dev' && 'true' || 'false' }}
permissions:
contents: write
jobs:
linux:
name: linux-${{ matrix.arch }}-${{ matrix.config }}-${{ matrix.gcc-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
arch: [amd64]
config: [Release, Debug]
gcc-version: ["g++-9", "g++-10", "g++-12"]
os: ["ubuntu-22.04"]
env:
OUTPUT_NAME: ekizu-linux-${{ matrix.arch }}-${{ matrix.config }}-${{ matrix.gcc-version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt update && sudo apt install -y cmake ${{ matrix.gcc-version }} libssl-dev ninja-build rpm zlib1g-dev
- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
with:
boost_version: 1.81.0
- name: Configure CMake
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -Dekizu_BUILD_EXAMPLES=OFF
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
CXX: ${{ matrix.gcc-version }}
- name: Build
run: cmake --build build --config ${{ matrix.config }}
- name: Package
run: cd build && cpack -C ${{ matrix.config }} --verbose
- name: Rename Packages
run: |
mv build/*.deb build/${{ env.OUTPUT_NAME }}.deb
mv build/*.rpm build/${{ env.OUTPUT_NAME }}.rpm
- name: Upload Binary (DEB)
uses: actions/upload-artifact@v3
with:
name: ${{ env.OUTPUT_NAME }}.deb
path: build/*.deb
- name: Upload Binary (RPM)
uses: actions/upload-artifact@v3
with:
name: ${{ env.OUTPUT_NAME }}.rpm
path: build/*.rpm
windows:
strategy:
fail-fast: false
matrix:
arch: [x64, x86]
config: [Release, Debug]
vs:
- { name: 2019, version: 16, os: windows-2019 }
- { name: 2022, version: 17, os: windows-2022 }
name: windows-${{ matrix.arch }}-${{ matrix.config }}-vs${{ matrix.vs.name }}
runs-on: ${{ matrix.vs.os }}
env:
OUTPUT_NAME: ekizu-windows-${{ matrix.arch }}-${{ matrix.config }}-vs${{ matrix.vs.name }}.zip
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Install OpenSSL
uses: johnwason/vcpkg-action@v5
id: vcpkg
with:
pkgs: openssl zlib
triplet: ${{ matrix.arch }}-windows-static
cache-key: ${{ runner.os }}-${{ matrix.arch }}-vcpkg
token: ${{ github.token }}
- name: Configure CMake (x64)
if: ${{ matrix.arch == 'x64' }}
run: cmake ${{ steps.vcpkg.outputs.vcpkg-cmake-config }} -S . -B build -G "Visual Studio ${{ matrix.vs.version }} ${{ matrix.vs.name }}" -A x64 -T host=x64 -Dekizu_BUILD_EXAMPLES=OFF
- name: Configure CMake (x86)
if: ${{ matrix.arch == 'x86' }}
run: cmake ${{ steps.vcpkg.outputs.vcpkg-cmake-config }} -S . -B build -G "Visual Studio ${{ matrix.vs.version }} ${{ matrix.vs.name }}" -A Win32 -T host=x86 -Dekizu_BUILD_EXAMPLES=OFF
- name: Build
run: cmake --build build --config ${{ matrix.config }}
- name: Package
run: cd build && cpack -C ${{ matrix.config }} --verbose
- name: Rename Package
run: mv build/*.zip build/${{ env.OUTPUT_NAME }}
- name: Upload Package
uses: actions/upload-artifact@v3
with:
name: ${{ env.OUTPUT_NAME }}
path: build/${{ env.OUTPUT_NAME }}
release:
needs: [linux, windows]
runs-on: ubuntu-22.04
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: ${{ env.BRANCH_NAME }}
- name: Create Draft Release
uses: ncipollo/[email protected]
with:
prerelease: true
draft: false
commit: ${{ github.sha }}
tag: ${{ steps.semver.outputs.next }}
name: ${{ steps.semver.outputs.next }}
body: "*pending*"
token: ${{ github.token }}
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ steps.semver.outputs.next }}
writeToFile: false
- name: Create Release
uses: ncipollo/[email protected]
with:
prerelease: ${{ env.PRERELEASE }}
allowUpdates: true
draft: false
makeLatest: true
commit: ${{ github.sha }}
tag: ${{ steps.semver.outputs.next }}
name: ${{ steps.semver.outputs.next }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
outputs:
next: ${{ steps.semver.outputs.next }}
upload:
needs: release
runs-on: ubuntu-22.04
if: github.event_name == 'push'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: .
- name: Upload artifacts to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
file_glob: true
file: "**/*"
tag: ${{ needs.release.outputs.next }}