-
Notifications
You must be signed in to change notification settings - Fork 10
195 lines (184 loc) · 8.05 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
env:
GENERATOR_BUILID: "pr-161"
# valid options: "release", "latest", "pr-NNN"
# "release" is the latest djinni generator release
# "latest" is the djinni generator build of the latest state of main, might be equal release, or newer
# "pr-NNN" is the djinni generator build of a pull request, NNN is the pullrequest number
# This can be used to check that a support lib builds with new generator changes that have not been released yet
# Note: the pipeline will not succeed with a generator different than release,
# but we can verify that the support lib builds and tests successfully with a generator different (newer) than release
name: build-all-configs
on: [push, pull_request]
jobs:
build-on-osx-for-objectiveC:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_OBJC=ON -G Xcode
- name: Build release
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
- name: Install files
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release --target install -- DESTDIR=check_install_root
- name: List installed files
working-directory: build/check_install_root
run: du -a | tail -r | awk -F ' ' '{print $2}'
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: diff -u ../../test/objc_list.txt <(du -a | tail -r | awk -F ' ' '{print $2}')
build-on-osx-for-python:
runs-on: macos-11
strategy:
matrix:
python-version: ["3.7.17", "3.12.1"] # oldest and newest, rest assumed to work
steps:
- name: Test Secret Value
env:
TEST_SECRET: ${{ secrets.GENERATOR_DL_TOKEN }}
TEST_VAL: ${{ vars.TEST_VAR }}
run: |
echo "Length of secret: ${#TEST_SECRET}"
echo "Length of val: ${#TEST_VAL}"
- uses: actions/checkout@v2
# - uses: asdf-vm/actions/install@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
uses: py-actions/py-dependency-install@v3
with:
path: "requirements.txt"
- name: Download Generator
run: |
python get-generator.py $GENERATOR_BUILID ${{ secrets.GENERATOR_DL_TOKEN }}
env:
GENERATOR_BUILID: ${{ env.GENERATOR_BUILID }}
GENERATOR_DL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_PYTHON=ON -DDJINNI_EXECUTABLE="$(pwd)/zz/djinni"
- name: Build release
run: cmake --build build --parallel $(sysctl -n hw.ncpu) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
build-on-ubuntu-for-jni:
runs-on: ubuntu-latest
steps:
- name: Test Secret Value
env:
TEST_SECRET: ${{ secrets.GENERATOR_DL_TOKEN }}
run: |
echo "Length of secret: ${#TEST_SECRET}"
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON
- name: Build release
run: cmake --build build --parallel $(nproc) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
- name: Install files
run: cmake --build build --parallel $(nproc) --config Release --target install -- DESTDIR=check_install_root
- name: List installed files
working-directory: build/check_install_root
run: du -a | tac | awk -F ' ' '{print $2}' | sort
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: diff -u ../../test/jni_list.txt <(du -a | tac | awk -F ' ' '{print $2}' | sort)
build-on-ubuntu-for-jni-with-thread-attach:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON -DJNI_CPP_THREAD_ATTACH=ON -DCMAKE_BUILD_TYPE=Release
- name: Build release
run: cmake --build build --parallel $(nproc)
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
build-on-ubuntu-for-android_arm32-with-thread-attach:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.2
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_JNI=ON -DJNI_CPP_THREAD_ATTACH=ON -DCMAKE_BUILD_TYPE=Release -DJINNI_BUILD_TESTING=OFF -DCMAKE_TOOLCHAIN_FILE=${ANDROID_SDK_ROOT}/ndk/$(ls ${ANDROID_SDK_ROOT}/ndk -C1 | sort -r | head -1)/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-26 -DANDROID_NATIVE_API_LEVEL=26 -DANDROID_ABI=armeabi-v7a -G Ninja
- name: Build release
run: cmake --build build --parallel $(nproc)
build-on-ubuntu-for-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: asdf-vm/actions/install@v1
- name: Install dependencies
uses: py-actions/py-dependency-install@v3
with:
path: "requirements.txt"
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_PYTHON=ON
- name: Build release
run: cmake --build build --parallel $(nproc) --config Release
- name: Run tests
working-directory: build/test-suite
run: ctest -C Release -V
build-on-windows-for-cppcli:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: install djinni
run: |
$VERSION = 'v' + [regex]::Match((Get-Content .tool-versions), '^djinni (\d+.\d+.\d+)').captures.groups[1].value
$URL = 'https://github.com/cross-language-cpp/djinni-generator/releases/download/' + $VERSION + '/djinni.bat'
Invoke-WebRequest -Uri $URL -OutFile djinni.bat
- name: Report cmake version
run: cmake --version
- name: Configure cmake
run: cmake -S . -B build -DDJINNI_WITH_CPPCLI=ON -DCMAKE_INSTALL_PREFIX=build/check_install_root -DDJINNI_EXECUTABLE="$(((Get-Location).Path) -replace "\\","/")/djinni.bat" -G "Visual Studio 17 2022"
- name: Install nuget dependencies
working-directory: build/test-suite
run: dotnet restore DjinniCppCliTest.csproj --runtime win-x64
- name: Build release
run: cmake --build build --config Release
- name: Run tests
working-directory: build/test-suite
run: dotnet test Release/DjinniCppCliTest.dll
- name: Install files
run: cmake --build build --config Release --target install
- name: List installed files
working-directory: build/check_install_root
run: Resolve-Path -Path (Get-ChildItem -Recurse).FullName -Relative
- name: Test if expected files have been installed
working-directory: build/check_install_root
run: if((Compare-Object (Get-Content ..\..\test\cppcli_list.txt) (Resolve-Path -Path (Get-ChildItem -Recurse).FullName -Relative))) { Write-Error "file list not equal" }
check_generator_buildid:
needs: ["build-on-windows-for-cppcli", "build-on-ubuntu-for-python", "build-on-ubuntu-for-android_arm32-with-thread-attach", "build-on-ubuntu-for-jni-with-thread-attach", "build-on-ubuntu-for-jni", "build-on-osx-for-python", "build-on-osx-for-objectiveC"]
runs-on: ubuntu-latest
steps:
- name: Check GENERATOR_BUILID
run: |
if [[ "${{ env.GENERATOR_BUILID }}" != "release" ]]; then
echo "GENERATOR_BUILID is not set to 'release'"
exit 1
fi