-
-
Notifications
You must be signed in to change notification settings - Fork 3
146 lines (128 loc) · 9.51 KB
/
Copy pathbuild.yml
File metadata and controls
146 lines (128 loc) · 9.51 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
name: Build and test
on:
pull_request:
push:
paths-ignore:
- '.github/workflows/coverage.yml'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'README.md'
jobs:
build:
strategy:
fail-fast: false
matrix:
confs:
- { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: x86, mode: debug, test: true, }
- { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: x86, mode: releasedbg, test: true, }
- { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: x64, mode: debug, test: true, }
- { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: x64, mode: releasedbg, test: true, }
- { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: arm64, mode: debug, test: false, }
- { name: Windows, runner: windows-latest, shell: pwsh, plat: windows, arch: arm64, mode: releasedbg, test: false, }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: i686, mode: debug, test: true, msystem: mingw32 }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: i686, mode: releasedbg, test: true, msystem: mingw32 }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: x86_64, mode: debug, test: true, msystem: mingw64 }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: x86_64, mode: releasedbg, test: true, msystem: mingw64 }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, test: true, }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, test: true, config: --asan=y }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, test: true, config: --lsan=y }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, test: true, config: --tsan=y }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: releasedbg, test: true, }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: debug, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: releasedbg, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: debug, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: releasedbg, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: debug, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: releasedbg, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: debug, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: releasedbg, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: macOS x86_64, runner: macos-latest, shell: bash, plat: macosx, arch: x86_64, mode: debug, test: true, }
- { name: macOS x86_64, runner: macos-latest, shell: bash, plat: macosx, arch: x86_64, mode: releasedbg, test: true, }
- { name: macOS ARM64, runner: macos-14, shell: bash, plat: macosx, arch: arm64, mode: debug, test: true, }
- { name: macOS ARM64, runner: macos-14, shell: bash, plat: macosx, arch: arm64, mode: releasedbg, test: true, }
- { name: iOS, runner: macos-latest, shell: bash, plat: iphoneos, arch: arm64, mode: debug, test: false, }
- { name: iOS, runner: macos-latest, shell: bash, plat: iphoneos, arch: arm64, mode: releasedbg, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm32, mode: debug, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm32, mode: releasedbg, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm64, mode: debug, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm64, mode: releasedbg, test: false, }
cxxver: [cxx17, cxx20, cxxlatest]
defaults:
run:
shell: ${{ matrix.confs.shell }}
name: ${{ matrix.confs.name }} ${{ matrix.confs.arch }} (${{ matrix.confs.mode }}) - ${{ matrix.cxxver }}
runs-on: ${{ matrix.confs.runner }}
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
steps:
- name: Get current date as package key
id: cache_key
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT
shell: bash
- name: Checkout repository
uses: actions/checkout@v6
# Setup Emsdk
- name: Setup emscripten
if: ${{ matrix.confs.plat == 'wasm' }}
uses: mymindstorm/setup-emsdk@v15
with:
version: 4.0.15
actions-cache-folder: emsdk-cache-${{ matrix.confs.mode }}
# Setup MSYS2
- name: Setup MSYS2
if: ${{ matrix.confs.plat == 'mingw' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.confs.msystem }}
install: base-devel git unzip p7zip mingw-w64-${{ matrix.confs.arch }}-toolchain mingw-w64-${{ matrix.confs.arch }}-xmake
update: true
# Setup NDK
- name: Setup Android NDK (${{ matrix.confs.ndk_ver }})
if: ${{ matrix.confs.plat == 'android' }}
run: |
wget -q https://dl.google.com/android/repository/android-ndk-r${{ matrix.confs.ndk_ver }}-linux.zip
unzip -q -o ./android-ndk-r${{ matrix.confs.ndk_ver }}-linux.zip
echo "ADDITIONAL_CONF=--ndk=`pwd`/android-ndk-r${{ matrix.confs.ndk_ver }} --ndk_sdkver=${{ matrix.confs.ndk_sdkver }}" >> $GITHUB_ENV
# Force xmake to a specific folder (for cache)
- name: Set xmake env
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
shell: bash
# Install xmake
- name: Setup xmake
if: ${{ matrix.confs.plat != 'mingw' }}
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
actions-cache-folder: .xmake-cache-W${{ steps.cache_key.outputs.key }}
# Update xmake repository (in order to have the file that will be cached)
- name: Update xmake repository
run: xmake repo --update
# Fetch xmake dephash
- name: Retrieve dependencies hash
id: dep_hash
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
shell: bash
# Restore xmake dependencies
- name: Restore cached xmake dependencies
id: restore-depcache
uses: actions/cache/restore@v5
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ matrix.confs.plat }}-${{ matrix.confs.arch }}-${{ matrix.confs.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
# Setup compilation mode and install project dependencies
- name: Configure xmake and install dependencies
run: xmake config --tests=y --tests_cxx_version=${{ matrix.cxxver }} --plat=${{ matrix.confs.plat }} --arch=${{ matrix.confs.arch }} --mode=${{ matrix.confs.mode }} ${{ matrix.confs.config }} ${{ env.ADDITIONAL_CONF }} --ccache=n --yes
# Save dependencies
- name: Save cached xmake dependencies
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
uses: actions/cache/save@v5
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
# Build library and tests
- name: Build library
run: xmake
# Run unit tests
- name: Run unit tests
if: ${{ matrix.confs.test }}
run: xmake run UnitTests