-
Notifications
You must be signed in to change notification settings - Fork 304
195 lines (169 loc) · 5.45 KB
/
build_wrapper.yaml
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
name: Multiplatform build of libuuu wrapper python package
on:
push:
branches:
- master
tags:
- uuu*
pull_request:
types:
- opened
- synchronize
jobs:
build-dlls:
name: Build of dynamically linked libraries
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x86_64, arm64]
exclude:
- os: windows-latest
arch: arm64
- os: ubuntu-latest
arch: arm64
steps:
- name: Checkout uuu repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: false
- name: Clone vcpkg repository
run: |
git clone https://github.com/microsoft/vcpkg.git
- name: Set up vcpkg on Windows
working-directory: ./vcpkg
if: matrix.os == 'windows-latest'
run: |
echo ("VCPKG_ROOT=" + $PWD.Path) >> $env:GITHUB_ENV
./bootstrap-vcpkg.bat
- name: Set up vcpkg on Ubuntu and MacOS
working-directory: ./vcpkg
if: matrix.os != 'windows-latest'
run: |
echo "VCPKG_ROOT=$(pwd)" >> $GITHUB_ENV
./bootstrap-vcpkg.sh
- name: Install dependencies Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install gcc cmake ninja-build autotools-dev automake autoconf libudev-dev
- name: Install dependencies MacOS
if: matrix.os == 'macos-latest'
run: |
brew install ninja cmake autoconf automake libtool
- name: Install dependencies Windows
if: matrix.os == 'windows-latest'
run: |
choco install cmake pkgconfiglite
- name: Build on Ubuntu and MacOS
working-directory: ./wrapper
if: matrix.os != 'windows-latest'
run: |
export PATH=$VCPKG_ROOT:$PATH
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
cmake --preset=unix;
else
cmake --preset=unix -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }};
fi
cmake --build build
- name: Build on Windows
working-directory: ./wrapper
if: matrix.os == 'windows-latest'
run: |
$env:Path = $env:VCPKG_ROOT + ';' + $env:Path
cmake --preset=windows
cmake --build build
- name: Upload artifacts Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: libuuu-windows
path: ./wrapper/build/Debug/*.dll
- name: Upload artifacts MacOS
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: pre-libuuu-macos-${{ matrix.arch }}
path: ./wrapper/build/libuuu.dylib
- name: Upload artifacts Ubuntu
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: libuuu-ubuntu-${{ matrix.arch }}
path: ./wrapper/build/libuuu.so
create-universal-dylib:
runs-on: macos-latest
needs: build-dlls
steps:
- name: Download x86_64 artifacts
uses: actions/download-artifact@v4
with:
name: pre-libuuu-macos-x86_64
path: ./x86_64
- name: Download arm64 artifacts
uses: actions/download-artifact@v4
with:
name: pre-libuuu-macos-arm64
path: ./arm64
- name: Create build directory
run: mkdir -p ./wrapper/build
- name: Create universal dylib
run: |
lipo -create -output ./wrapper/build/libuuu.dylib ./x86_64/libuuu.dylib ./arm64/libuuu.dylib
- name: Upload universal dylib
uses: actions/upload-artifact@v4
with:
name: libuuu-macos-universal
path: ./wrapper/build/libuuu.dylib
build-libuuu-wrapper:
runs-on: ubuntu-latest
needs: create-universal-dylib
steps:
- name: Checkout uuu repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: false
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: libuuu-*
merge-multiple: true
path: ./wrapper/libuuu/lib/
- name: Check the path
run: |
find ./wrapper/
- name: Install python dependencies
working-directory: ./wrapper
run: |
pip install --upgrade pip
pip install --force-reinstall -U build twine nxp-codecheck colorama setuptools_scm
- name: Build the python package
working-directory: ./wrapper
run: |
python -m build --sdist --wheel
- name: Run codecheck
working-directory: ./wrapper
run: |
codecheck -s
- name: Upload reports if codecheck fails
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: reports
path: ./wrapper/reports/*
- name: Release package to pypi
if: github.ref_type == 'tag'
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
#TWINE_REPOSITORY_URL: ${{ secrets.TWINE_REPOSITORY_URL }}
working-directory: ./wrapper
run: |
twine --no-color check dist/*
twine --no-color upload --repository pypi dist/*
- name: Upload the dist folder
uses: actions/upload-artifact@v4
with:
name: dist
path: ./wrapper/dist