-
Notifications
You must be signed in to change notification settings - Fork 17
172 lines (148 loc) · 4.85 KB
/
Copy pathmain.yml
File metadata and controls
172 lines (148 loc) · 4.85 KB
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
name: Continuous Integration
on:
push:
branches: [ "main" ]
tags-ignore: ['*']
paths-ignore: ['**.md']
pull_request:
branches: [ "main" ]
paths-ignore: ['**.md']
workflow_dispatch:
env:
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
defaults:
run:
shell: ${{ matrix.config.shell }}
strategy:
fail-fast: false
matrix:
config:
- name: Linux GCC
os: ubuntu-latest
compiler: gcc
shell: bash
extra-options: -DTARADINO_WARNINGS_AS_ERRORS=ON
- name: macOS Clang
os: macos-latest
compiler: clang
shell: bash
extra-options: -DTARADINO_WARNINGS_AS_ERRORS=ON
- name: MSYS2 UCRT64
os: windows-latest
compiler: gcc
shell: 'msys2 {0}'
msystem: ucrt64
msys-env: mingw-w64-ucrt-x86_64
extra-options: -DTARADINO_WARNINGS_AS_ERRORS=ON
- name: MSVC x64
os: windows-latest
compiler: cl
shell: pwsh
extra-options: >-
-A x64
-DCMAKE_TOOLCHAIN_FILE="${env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows-static-release
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
-DCMAKE_IGNORE_PATH="C:/Strawberry/perl/bin;C:/Strawberry/c/lib"
steps:
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install \
cmake \
libsdl2-dev \
libsdl2-mixer-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install \
sdl2 \
sdl2_mixer
- name: Install dependencies (MSYS2)
if: matrix.config.shell == 'msys2 {0}'
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msystem }}
update: false
install: >-
${{ matrix.config.msys-env }}-gcc
${{ matrix.config.msys-env }}-cmake
${{ matrix.config.msys-env }}-SDL2
${{ matrix.config.msys-env }}-SDL2_mixer
- uses: actions/checkout@v4
- name: Restore vcpkg cache
if: ${{ matrix.config.name == 'MSVC x64' }}
id: cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-x64-windows-static-release
- name: Configure shareware executable
env:
CC: ${{ matrix.config.compiler }}
run: >-
cmake -B build-shareware
-DTARADINO_SHAREWARE=ON
-DTARADINO_SUFFIX=shareware
${{ matrix.config.extra-options }}
- name: Configure registered executable
env:
CC: ${{ matrix.config.compiler }}
run: >-
cmake -B build-registered
-DTARADINO_SHAREWARE=OFF
${{ matrix.config.extra-options }}
# Delete the old cache on hit to emulate a cache update.
- name: Delete old cache
if: steps.cache.outputs.cache-hit
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: gh cache delete --repo ${{ github.repository }} ${{ steps.cache.outputs.cache-primary-key }}
- name: Save cache
if: ${{ matrix.config.name == 'MSVC x64' }}
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Build shareware executable
run: cmake --build build-shareware --config Release
- name: Install shareware executable
if: ${{ matrix.config.name == 'MSVC x64' }}
run: |
cd build-shareware
cpack
- name: Build registered executable
run: cmake --build build-registered --config Release
- name: Install registered executable
if: ${{ matrix.config.name == 'MSVC x64' }}
run: |
cd build-registered
cpack
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.config.name == 'MSVC x64' }}
with:
name: taradino-${{ github.sha }}-win64
path: |
build-shareware/*.zip
build-registered/*.zip
cppcheck:
name: Cppcheck
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install cppcheck
- uses: actions/checkout@v4
- name: Run cppcheck
shell: bash
run: |
cppcheck --version
cppcheck --error-exitcode=1 -j4 -q --force -U_WIN32 -U__APPLE__ -Irott rott