-
Notifications
You must be signed in to change notification settings - Fork 33
174 lines (145 loc) · 7.82 KB
/
build.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
# https://docs.github.com/en/actions/learn-github-actions/contexts
---
name: mdflib
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
vcpkgCommitId: e590c2b30c08caf1dd8d612ec602a003f9784b7d
jobs:
windows:
name: run on ${{ matrix.os }}(${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
arch: [x64, x64_x86]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup cmake
uses: lukka/get-cmake@latest
# Setup vcpkg: ensures vcpkg is downloaded and built.
# Since vcpkg.json is being used later on to install the packages
# when `run-cmake` runs, no packages are installed at this time
# (and vcpkg does not run).
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
# This is the default location of the directory containing vcpkg sources.
# Change it to the right location if needed.
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
# If not using a submodule for vcpkg sources, this specifies which commit
# id must be checkout from a Git repo.
# Note: it must not be set if using a Git submodule for vcpkg.
vcpkgGitCommitId: '${{ env.vcpkgCommitId }}'
# This is the glob expression used to locate the vcpkg.json.
# Change it to match a single manifest file you want to use.
# Note: do not use `${{ github.context }}` to compose the value as it
# contains backslashes that would be misinterpreted. Instead
# compose a value relative to the root of the repository using
# `**/path/from/root/of/repo/to/vcpkg.json` to match the desired `vcpkg.json`.
vcpkgJsonGlob: '**/vcpkg.json'
# This is only needed if the command `vcpkg install` must run at this step.
# Instead it is highly suggested to let `run-cmake` to run vcpkg later on
# using the vcpkg.cmake toolchain. The default is `false`.
# runVcpkgInstall: true
- name: Build Static
uses: lukka/run-cmake@v10
with:
# This is the default path to the CMakeLists.txt along side the
# CMakePresets.json. Change if you need have CMakeLists.txt and CMakePresets.json
# located elsewhere.
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
# This is the name of the CMakePresets.json's configuration to use to generate
# the project files. This configuration leverages the vcpkg.cmake toolchain file to
# run vcpkg and install all dependencies specified in vcpkg.json.
configurePreset: 'msvc-vcpkg-static-${{ matrix.arch }}'
configurePresetAdditionalArgs: "['-DMDF_BUILD_SHARED_LIB_NET=ON']"
# This is the name of the CMakePresets.json's configuration to build the project.
buildPreset: 'msvc-vcpkg-static-${{ matrix.arch }}-release'
- name: Build Test
uses: lukka/run-cmake@v10
with:
# This is the default path to the CMakeLists.txt along side the
# CMakePresets.json. Change if you need have CMakeLists.txt and CMakePresets.json
# located elsewhere.
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
# This is the name of the CMakePresets.json's configuration to use to generate
# the project files. This configuration leverages the vcpkg.cmake toolchain file to
# run vcpkg and install all dependencies specified in vcpkg.json.
configurePreset: 'msvc-vcpkg-${{ matrix.arch }}'
configurePresetAdditionalArgs: "['-DMDF_BUILD_SHARED_LIB_NET=ON', '-DMDF_BUILD_TEST=ON', '-DMDF_BUILD_SHARED_LIB_EXAMPLE=ON']"
# This is the name of the CMakePresets.json's configuration to build the project.
buildPreset: 'msvc-vcpkg-${{ matrix.arch }}-debug'
# This is the name of the CMakePresets.json's configuration to test the project with.
testPreset: 'msvc-vcpkg-${{ matrix.arch }}'
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: mdflibs-${{ matrix.os }}-static-${{ matrix.arch }}
path: install/msvc-vcpkg-static-${{ matrix.arch }}/
mac-and-ubuntu:
name: run on ${{ matrix.os }}(${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
arch: [x64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup cmake
uses: lukka/get-cmake@latest
# Setup vcpkg: ensures vcpkg is downloaded and built.
# Since vcpkg.json is being used later on to install the packages
# when `run-cmake` runs, no packages are installed at this time
# (and vcpkg does not run).
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
# This is the default location of the directory containing vcpkg sources.
# Change it to the right location if needed.
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
# If not using a submodule for vcpkg sources, this specifies which commit
# id must be checkout from a Git repo.
# Note: it must not be set if using a Git submodule for vcpkg.
vcpkgGitCommitId: '${{ env.vcpkgCommitId }}'
# This is the glob expression used to locate the vcpkg.json.
# Change it to match a single manifest file you want to use.
# Note: do not use `${{ github.context }}` to compose the value as it
# contains backslashes that would be misinterpreted. Instead
# compose a value relative to the root of the repository using
# `**/path/from/root/of/repo/to/vcpkg.json` to match the desired `vcpkg.json`.
vcpkgJsonGlob: '**/vcpkg.json'
# This is only needed if the command `vcpkg install` must run at this step.
# Instead it is highly suggested to let `run-cmake` to run vcpkg later on
# using the vcpkg.cmake toolchain. The default is `false`.
# runVcpkgInstall: true
- name: Install dependencies
run: sudo apt-get install -y libxi-dev libxtst-dev libxrandr-dev
if: runner.os == 'Linux'
- name: Build And Test
uses: lukka/run-cmake@v10
with:
# This is the default path to the CMakeLists.txt along side the
# CMakePresets.json. Change if you need have CMakeLists.txt and CMakePresets.json
# located elsewhere.
cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt'
# This is the name of the CMakePresets.json's configuration to use to generate
# the project files. This configuration leverages the vcpkg.cmake toolchain file to
# run vcpkg and install all dependencies specified in vcpkg.json.
configurePreset: 'ninja-vcpkg-${{ matrix.arch }}'
configurePresetAdditionalArgs: "['-DMDF_BUILD_TEST=ON', '-DMDF_BUILD_SHARED_LIB_EXAMPLE=ON', '-DMDF_BUILD_TOOL=ON']"
# This is the name of the CMakePresets.json's configuration to build the project.
buildPreset: 'ninja-vcpkg-${{ matrix.arch }}-release'
# This is the name of the CMakePresets.json's configuration to test the project with.
testPreset: 'ninja-vcpkg-${{ matrix.arch }}'
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: mdflibs-${{ matrix.os }}-${{ matrix.arch }}
path: install/ninja-vcpkg-${{ matrix.arch }}/