-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (131 loc) · 5.15 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
name: CI
on: [push, pull_request]
permissions:
contents: read
env:
BUILD_NUMBER: ${{ github.run_number }}
CMAKE_BUILD_PARALLEL_LEVEL: 4
# Required dependencies (does not include packaging and optional dependencies)
UBUNTU_DEPS: cmake libxml2-dev zlib1g-dev libssl-dev libflatbuffers-dev
jobs:
ubuntu:
name: Build on Ubuntu ${{ matrix.container }} ${{ matrix.arch }}
runs-on: ubuntu-24.04${{ matrix.arch == 'arm64' && '-arm' || '' }}
container: ubuntu:${{ matrix.container }}
strategy:
matrix:
container: ['22.04', '24.04', '24.10']
arch: ['amd64', 'arm64']
env:
DEBIAN_FRONTEND: noninteractive
DEBFULLNAME: github-actions
DEBEMAIL: [email protected]
steps:
- name: Install dependencies
run: apt update -qq && apt install --no-install-recommends -y lsb-release build-essential devscripts debhelper lintian pkg-config ${UBUNTU_DEPS} doxygen swig openjdk-17-jdk-headless libpython3-dev python3-setuptools libboost-test-dev
- name: Checkout
uses: actions/checkout@v4
- name: Setup changelog
run: |
export VERSION=$(grep project CMakeLists.txt | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
export VERSIONEX=${VERSION}.${BUILD_NUMBER}.$(lsb_release -rs)
dch --distribution $(lsb_release -cs) -v ${VERSIONEX} "Release ${VERSIONEX}."
- name: Build packages
run: |
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${{ matrix.arch }} dpkg-buildpackage -us -uc
mv ../libcdoc*.* .
- name: Lintian
run: lintian *.deb;
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ubuntu_${{ matrix.container }}_${{ matrix.arch }}
path: libcdoc*.*
macos:
name: Build on macOS for ${{ matrix.target }}
runs-on: macos-latest
strategy:
matrix:
target: [macos, iphoneos, iphonesimulator]
include:
- target: iphoneos
triplet: arm64-ios
- target: iphonesimulator
triplet: arm64-ios-simulator
env:
DEST: ${{ github.workspace }}/${{ matrix.target }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
brew update
brew install --formula ninja flatbuffers swig doxygen boost [email protected]
brew unlink [email protected] || true
brew unlink [email protected] || true
- name: Prepare vcpkg
if: matrix.target != 'macos'
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
- name: Build
run: |
cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=${{ env.DEST }}
cmake --build --preset ${{ matrix.target }}
- name: Test
if: matrix.target == 'macos'
run: cmake --build --preset ${{ matrix.target }} --target test
- name: Install
run: cmake --build --preset ${{ matrix.target }} --target install/strip
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ env.DEST }}
windows:
name: Build on Windows
runs-on: ${{ matrix.image }}
strategy:
matrix:
image: [windows-2022]
platform: [x64, arm64]
env:
CXXFLAGS: '/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR' # https://github.com/actions/runner-images/issues/10004
DEST: ${{ github.workspace }}/${{ matrix.image }}_${{ matrix.platform }}
VCPKG_DEFAULT_TRIPLET: ${{ matrix.platform }}-windows-static-md
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
vcpkgJsonGlob: ./vcpkg.json
runVcpkgInstall: true
runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `$[env.VCPKG_DEFAULT_TRIPLET]`, `--x-feature`, `tests`]"
env:
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/build/vcpkg_installed
- name: Install dependencies
run: |
choco install doxygen.install -y > $null
Invoke-WebRequest -UserAgent "Wget" "https://sourceforge.net/projects/swig/files/swigwin/swigwin-4.3.0/swigwin-4.3.0.zip/download" -OutFile swig.zip
tar xf swig.zip
- name: Build
run: |
cmake -A ${{ matrix.platform }} -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo `
"-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" `
"-DSWIG_EXECUTABLE=${{ github.workspace }}/swigwin-4.3.0/swig.exe" `
-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_DEFAULT_TRIPLET }} `
-DVCPKG_MANIFEST_FEATURES=tests `
-DCMAKE_INSTALL_LIBDIR=bin
cmake --build build --config RelWithDebInfo
cmake --install build --config RelWithDebInfo --prefix ${{ env.DEST }}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.image }}_${{ matrix.platform }}
path: ${{ env.DEST }}