-
Notifications
You must be signed in to change notification settings - Fork 32
138 lines (118 loc) · 4.45 KB
/
main.yml
File metadata and controls
138 lines (118 loc) · 4.45 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
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push, pull request or manual events
on:
push:
pull_request:
workflow_dispatch:
# Run GitHub Actions monthly to make sure CI isn't broken
schedule:
- cron: '0 0 1 * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: "Build"
strategy:
matrix:
os:
- runs-on: windows-2022
vcpkg-triplet: x86-windows-static
preset: ci-windows
- runs-on: ubuntu-22.04
vcpkg-triplet: x86-linux
preset: ci-linux
target: [client, server]
# The type of runner that the job will run on
runs-on: ${{ matrix.os.runs-on }}
env:
VCPKG_ROOT: '${{github.workspace}}/vcpkg'
VCPKG_DEFAULT_TRIPLET: '${{ matrix.os.vcpkg-triplet }}'
VCPKG_DEFAULT_HOST_TRIPLET: '${{ matrix.os.vcpkg-triplet }}'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Required for automatic versioning
- name: Install Ubuntu packages
if: matrix.os.runs-on == 'ubuntu-22.04'
run: |
sudo dpkg --add-architecture i386
sudo apt update || true
sudo apt install -y libc6:i386 linux-libc-dev:i386 ninja-build gcc-multilib g++-multilib
# Restore artifacts, or setup vcpkg for building artifacts
- name: Set up vcpkg
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgJsonGlob: 'vcpkg.json'
vcpkgDirectory: '${{env.VCPKG_ROOT}}'
vcpkgGitCommitId: 'ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0'
runVcpkgInstall: false
# Run CMake+vcpkg+Ninja+CTest to generate/build/test.
- name: Build and Test with CMake
uses: lukka/run-cmake@v10
id: runcmake
with:
configurePreset: '${{ matrix.os.preset }}'
buildPreset: '${{ matrix.os.preset }}'
buildPresetAdditionalArgs: "['--target', 'ci-${{ matrix.target }}']"
testPreset: '${{ matrix.os.preset }}'
testPresetAdditionalArgs: "['-R', '${{ matrix.target }}']"
env:
VCPKG_FORCE_SYSTEM_BINARIES: 1
# Install
- name: Install with CMake
run: |
cmake --install ${{github.workspace}}/_build/${{ matrix.os.preset }} --prefix ${{github.workspace}}/_build/ci-install --component ${{ matrix.target }}
# Prepare artifact
- name: Prepare artifact
id: prepare_artifact
run: >
python scripts/package_target.py
--build-dir ${{github.workspace}}/_build/${{ matrix.os.preset }}
--install-dir ${{github.workspace}}/_build/ci-install
--artifact-dir ${{github.workspace}}/_build/ci-artifact
--target ${{ matrix.target }}
--suffix ${{ matrix.os.preset }}
# Upload result
- name: Upload build result
uses: actions/upload-artifact@v4
with:
name: ${{ steps.prepare_artifact.outputs.artifact_name }}
path: ${{github.workspace}}/_build/ci-artifact
merge-artifacts:
name: "Merge Artifacts"
needs: build
strategy:
matrix:
target: [client, server]
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: false # Only need scripts folder
# Download artifacts
- uses: actions/download-artifact@v4
with:
path: ${{github.workspace}}/_build/ci-artifacts
pattern: "*-${{ matrix.target }}-ci-*"
merge-multiple: true
# Merge them
- name: Merge artifacts
id: merge_artifacts
run: >
python scripts/merge_artifacts.py
--artifact-dir ${{github.workspace}}/_build/ci-artifacts
--out-dir ${{github.workspace}}/_build/ci-out-artifact
--target ${{ matrix.target }}
ci-linux
ci-windows
# Upload merged artifact
- name: Upload merged artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.merge_artifacts.outputs.artifact_name }}
path: ${{github.workspace}}/_build/ci-out-artifact