| 1 |
name: CD |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
- develop |
| 8 |
tags: |
| 9 |
- v* |
| 10 |
release: |
| 11 |
types: |
| 12 |
- published |
| 13 |
|
| 14 |
jobs: |
| 15 |
cxx: |
| 16 |
name: ${{ matrix.os_short }} c++ ${{ matrix.architecture }} |
| 17 |
runs-on: ${{ matrix.os }} |
| 18 |
timeout-minutes: 120 |
| 19 |
strategy: |
| 20 |
fail-fast: false |
| 21 |
matrix: |
| 22 |
os_arch: [ |
| 23 |
"windows-ia32", |
| 24 |
"windows-x64", |
| 25 |
"macos-x86_64", |
| 26 |
"macos-arm64", |
| 27 |
"linux-x86_64", |
| 28 |
"linux-aarch64", |
| 29 |
] |
| 30 |
include: |
| 31 |
- os_arch: "windows-ia32" |
| 32 |
os: "windows-2022" |
| 33 |
os_short: "windows" |
| 34 |
architecture: "ia32" |
| 35 |
cmake_generator_platform: "Win32" |
| 36 |
- os_arch: "windows-x64" |
| 37 |
os: "windows-2022" |
| 38 |
os_short: "windows" |
| 39 |
architecture: "x64" |
| 40 |
cmake_generator_platform: "x64" |
| 41 |
- os_arch: "macos-x86_64" |
| 42 |
os: "macos-11.0" |
| 43 |
os_short: "macos" |
| 44 |
architecture: "x86_64" |
| 45 |
- os_arch: "macos-arm64" |
| 46 |
os: "macos-11.0" |
| 47 |
os_short: "macos" |
| 48 |
architecture: "arm64" |
| 49 |
- os_arch: linux-x86_64 |
| 50 |
os: "ubuntu-22.04" |
| 51 |
os_short: "linux" |
| 52 |
architecture: "x86_64" |
| 53 |
docker_image: "dockcross/linux-x64:latest" |
| 54 |
- os_arch: linux-aarch64 |
| 55 |
os: "ubuntu-22.04" |
| 56 |
os_short: "linux" |
| 57 |
architecture: "aarch64" |
| 58 |
docker_image: "dockcross/linux-arm64-lts:latest" |
| 59 |
steps: |
| 60 |
- uses: actions/checkout@v3 |
| 61 |
with: |
| 62 |
fetch-depth: 0 |
| 63 |
- name: cxxlib |
| 64 |
shell: bash |
| 65 |
run: | |
| 66 |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then |
| 67 |
version="${GITHUB_REF##*/}" |
| 68 |
else |
| 69 |
version="$(date '+%Y.%-m.%-d').dev${GITHUB_RUN_NUMBER}" |
| 70 |
fi |
| 71 |
echo "${version}" > src/git-tag.txt |
| 72 |
|
| 73 |
if [ "${{ matrix.docker_image }}" != "" ]; then |
| 74 |
export OCL_DOCKER_IMAGE="${{ matrix.docker_image }}" |
| 75 |
fi |
| 76 |
if [ "${{ matrix.macos_architecture }}" != "" ]; then |
| 77 |
export OCL_MACOS_ARCHITECTURE="${{ matrix.architecture }}" |
| 78 |
fi |
| 79 |
if [ "${{ matrix.cmake_generator_platform }}" != "" ]; then |
| 80 |
export OCL_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}" |
| 81 |
fi |
| 82 |
|
| 83 |
./install.sh \ |
| 84 |
--build-library cxx \ |
| 85 |
--build-type release \ |
| 86 |
--install-ci-deps \ |
| 87 |
--install-boost \ |
| 88 |
--boost-prefix $(pwd) \ |
| 89 |
--install \ |
| 90 |
--install-prefix $(pwd)/dist |
| 91 |
- uses: actions/upload-artifact@v3 |
| 92 |
with: |
| 93 |
name: ${{ matrix.os_short }}-cxx-${{ matrix.architecture }} |
| 94 |
path: | |
| 95 |
dist |
| 96 |
nodejs: |
| 97 |
name: ${{ matrix.os_short }} node.js ${{ matrix.architecture }} |
| 98 |
runs-on: ${{ matrix.os }} |
| 99 |
timeout-minutes: 120 |
| 100 |
strategy: |
| 101 |
fail-fast: false |
| 102 |
matrix: |
| 103 |
os_arch: [ |
| 104 |
"windows-ia32", |
| 105 |
"windows-x64", |
| 106 |
"macos-x86_64", |
| 107 |
"macos-arm64", |
| 108 |
"linux-x86_64", |
| 109 |
"linux-aarch64", |
| 110 |
] |
| 111 |
include: |
| 112 |
- os_arch: "windows-ia32" |
| 113 |
os: "windows-2022" |
| 114 |
os_short: "windows" |
| 115 |
architecture: "ia32" |
| 116 |
cmake_generator_platform: "Win32" |
| 117 |
node_architecture: "ia32" |
| 118 |
- os_arch: "windows-x64" |
| 119 |
os: "windows-2022" |
| 120 |
os_short: "windows" |
| 121 |
architecture: "x64" |
| 122 |
cmake_generator_platform: "x64" |
| 123 |
node_architecture: "x64" |
| 124 |
- os_arch: "macos-x86_64" |
| 125 |
os: "macos-11.0" |
| 126 |
os_short: "macos" |
| 127 |
architecture: "x86_64" |
| 128 |
node_architecture: "x64" |
| 129 |
macos_architecture: "x86_64" |
| 130 |
- os_arch: "macos-arm64" |
| 131 |
os: "macos-11.0" |
| 132 |
os_short: "macos" |
| 133 |
architecture: "arm64" |
| 134 |
node_architecture: "arm64" |
| 135 |
macos_architecture: "arm64" |
| 136 |
- os_arch: linux-x86_64 |
| 137 |
os: "ubuntu-22.04" |
| 138 |
os_short: "linux" |
| 139 |
architecture: "x86_64" |
| 140 |
node_architecture: "x64" |
| 141 |
- os_arch: linux-aarch64 |
| 142 |
os: "ubuntu-22.04" |
| 143 |
os_short: "linux" |
| 144 |
architecture: "aarch64" |
| 145 |
node_architecture: "arm64" |
| 146 |
docker_image: ghcr.io/prebuild/linux-arm64-lts:latest |
| 147 |
steps: |
| 148 |
- uses: actions/checkout@v3 |
| 149 |
with: |
| 150 |
fetch-depth: 0 |
| 151 |
- name: nodejslib |
| 152 |
shell: bash |
| 153 |
run: | |
| 154 |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then |
| 155 |
version="${GITHUB_REF##*/}" |
| 156 |
else |
| 157 |
version="$(date '+%Y.%-m.%-d')-dev.${GITHUB_RUN_NUMBER}" |
| 158 |
fi |
| 159 |
echo "${version}" > src/git-tag.txt |
| 160 |
|
| 161 |
if [ "${{ matrix.docker_image }}" != "" ]; then |
| 162 |
export OCL_DOCKER_IMAGE="${{ matrix.docker_image }}" |
| 163 |
# there is an issue with the ghcr.io/prebuild/linux-arm64-lts:latest image, cmake --install does not work, so we install cmake ourselves in the container |
| 164 |
export OCL_DOCKER_IMAGE_BEFORE_INSTALL="curl https://cmake.org/files/v3.23/cmake-3.23.1-linux-x86_64.sh --output /tmp/cmake.sh --silent --location && chmod +x /tmp/cmake.sh && /tmp/cmake.sh --skip-license --prefix=/usr/local" |
| 165 |
elif [ "${{ matrix.macos_architecture }}" != "" ]; then |
| 166 |
export OCL_MACOS_ARCHITECTURE="${{ matrix.macos_architecture }}" |
| 167 |
elif [ "${{ matrix.cmake_generator_platform }}" != "" ]; then |
| 168 |
export OCL_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}" |
| 169 |
fi |
| 170 |
|
| 171 |
./install.sh \ |
| 172 |
--build-library nodejs \ |
| 173 |
--build-type release \ |
| 174 |
--install-ci-deps \ |
| 175 |
--install-boost \ |
| 176 |
--boost-prefix $(pwd) \ |
| 177 |
--node-architecture ${{ matrix.node_architecture }} \ |
| 178 |
--install \ |
| 179 |
--install-prefix $(pwd)/dist |
| 180 |
- uses: actions/upload-artifact@v3 |
| 181 |
with: |
| 182 |
name: ${{ matrix.os_short }}-nodejs-${{ matrix.node_architecture }} |
| 183 |
path: | |
| 184 |
dist |
| 185 |
python: |
| 186 |
name: ${{ matrix.os_short }} python ${{ matrix.architecture }} cp${{ matrix.python_version }} |
| 187 |
runs-on: ${{ matrix.os }} |
| 188 |
timeout-minutes: 240 |
| 189 |
strategy: |
| 190 |
fail-fast: false |
| 191 |
matrix: |
| 192 |
os_arch: [ |
| 193 |
"windows-ia32", |
| 194 |
"windows-x64", |
| 195 |
# "windows-arm64", |
| 196 |
"macos-x86_64", |
| 197 |
"macos-arm64", |
| 198 |
"linux-x86_64", |
| 199 |
"linux-aarch64", |
| 200 |
] |
| 201 |
python_version: [ |
| 202 |
"37", |
| 203 |
"38", |
| 204 |
"39", |
| 205 |
"310", |
| 206 |
"311", |
| 207 |
] |
| 208 |
exclude: |
| 209 |
- os_arch: "macos-arm64" |
| 210 |
python_version: "37" |
| 211 |
include: |
| 212 |
- os_arch: "windows-ia32" |
| 213 |
os: "windows-2022" |
| 214 |
os_short: "windows" |
| 215 |
architecture: "ia32" |
| 216 |
boost_architecture: "x86" |
| 217 |
cibuildwheel_architecture: "x86" |
| 218 |
boost_address_model: "32" |
| 219 |
cmake_generator_platform: "Win32" |
| 220 |
- os_arch: "windows-x64" |
| 221 |
os: "windows-2022" |
| 222 |
os_short: "windows" |
| 223 |
architecture: "x64" |
| 224 |
boost_architecture: "x86" |
| 225 |
boost_address_model: "64" |
| 226 |
cibuildwheel_architecture: "AMD64" |
| 227 |
cmake_generator_platform: "x64" |
| 228 |
# - os_arch: "windows-arm64" |
| 229 |
# os: "windows-2022" |
| 230 |
# os_short: "windows" |
| 231 |
# architecture: "arm64" |
| 232 |
# boost_architecture: "arm" |
| 233 |
# boost_address_model: "64" |
| 234 |
# cibuildwheel_architecture: "ARM64" |
| 235 |
# cmake_generator_platform: "ARM64" |
| 236 |
- os_arch: "macos-x86_64" |
| 237 |
os: "macos-11.0" |
| 238 |
os_short: "macos" |
| 239 |
architecture: "x86_64" |
| 240 |
boost_architecture: "x86" |
| 241 |
- os_arch: "macos-arm64" |
| 242 |
os: "macos-11.0" |
| 243 |
os_short: "macos" |
| 244 |
architecture: "arm64" |
| 245 |
boost_architecture: "arm" |
| 246 |
- os_arch: linux-x86_64 |
| 247 |
os: "ubuntu-22.04" |
| 248 |
os_short: "linux" |
| 249 |
architecture: "x86_64" |
| 250 |
boost_architecture: "x86" |
| 251 |
- os_arch: linux-aarch64 |
| 252 |
os: "ubuntu-22.04" |
| 253 |
os_short: "linux" |
| 254 |
architecture: "aarch64" |
| 255 |
boost_architecture: "arm" |
| 256 |
steps: |
| 257 |
- uses: actions/checkout@v3 |
| 258 |
with: |
| 259 |
fetch-depth: 0 |
| 260 |
# - name: Cache Boost.Python |
| 261 |
# id: cache-boost-python |
| 262 |
# uses: actions/cache@v3 |
| 263 |
# with: |
| 264 |
# path: boost-precompiled.tar.gz |
| 265 |
# key: boost-1.80.0-${{ matrix.os_short }}-${{ matrix.architecture }} |
| 266 |
- name: prepare |
| 267 |
shell: bash |
| 268 |
run: | |
| 269 |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then |
| 270 |
version="${GITHUB_REF##*/}" |
| 271 |
else |
| 272 |
version="$(date '+%Y.%-m.%-d').dev${GITHUB_RUN_NUMBER}" |
| 273 |
fi |
| 274 |
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak |
| 275 |
echo "${version}" > src/git-tag.txt |
| 276 |
- name: Set up QEMU |
| 277 |
uses: docker/setup-qemu-action@v2 |
| 278 |
if: matrix.architecture == 'aarch64' |
| 279 |
with: |
| 280 |
platforms: arm64 |
| 281 |
- name: Build wheels |
| 282 |
uses: pypa/[email protected] |
| 283 |
env: |
| 284 |
CIBW_BUILD: "cp${{ matrix.python_version }}-*" |
| 285 |
CIBW_PLATFORM: "${{ matrix.os_short }}" |
| 286 |
CIBW_BUILD_VERBOSITY: "1" |
| 287 |
CIBW_ARCHS_WINDOWS: "${{ matrix.cibuildwheel_architecture }}" |
| 288 |
CIBW_ENVIRONMENT_WINDOWS: > |
| 289 |
BOOST_ROOT="$(cygpath -w $(pwd))" |
| 290 |
OCL_BOOST_ADDRESS_MODEL="${{ matrix.boost_address_model }}" |
| 291 |
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}" |
| 292 |
CMAKE_GENERATOR="Visual Studio 17 2022" |
| 293 |
CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}" |
| 294 |
CIBW_ENVIRONMENT_PASS_WINDOWS: "BOOST_ROOT OCL_BOOST_ADDRESS_MODEL OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM" |
| 295 |
CIBW_ARCHS_MACOS: "${{ matrix.architecture }}" |
| 296 |
CIBW_ENVIRONMENT_MACOS: > |
| 297 |
BOOST_ROOT="$(pwd)" |
| 298 |
OCL_MACOS_ARCHITECTURE="${{ matrix.architecture }}" |
| 299 |
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}" |
| 300 |
OPENMP_PREFIX_MACOS="/tmp/libomp/libomp/fixed" |
| 301 |
CIBW_ENVIRONMENT_PASS_MACOS: "BOOST_ROOT OCL_BOOST_ARCHITECTURE OPENMP_PREFIX_MACOS" |
| 302 |
CIBW_ARCHS_LINUX: "${{ matrix.architecture }}" |
| 303 |
CIBW_ENVIRONMENT_LINUX: > |
| 304 |
BOOST_ROOT="$(pwd)" |
| 305 |
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}" |
| 306 |
CMAKE_GENERATOR="Unix Makefiles" |
| 307 |
CIBW_ENVIRONMENT_PASS_LINUX: "BOOST_ROOT OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR" |
| 308 |
# - name: Compress Boost.Python |
| 309 |
# shell: bash |
| 310 |
# run: | |
| 311 |
# if [ -d "boost_1_80_0" ]; then |
| 312 |
# tar -czf boost-precompiled.tar.gz boost_1_80_0 || true |
| 313 |
# fi |
| 314 |
- uses: actions/upload-artifact@v3 |
| 315 |
with: |
| 316 |
name: ${{ matrix.os_short }}-python-${{ matrix.architecture }} |
| 317 |
path: | |
| 318 |
./wheelhouse/*.whl |
| 319 |
emscripten: |
| 320 |
name: emscripten |
| 321 |
runs-on: ubuntu-22.04 |
| 322 |
timeout-minutes: 120 |
| 323 |
strategy: |
| 324 |
fail-fast: false |
| 325 |
steps: |
| 326 |
- uses: actions/checkout@v3 |
| 327 |
with: |
| 328 |
fetch-depth: 0 |
| 329 |
- name: emscripten |
| 330 |
shell: bash |
| 331 |
run: | |
| 332 |
./install.sh \ |
| 333 |
--build-library emscripten \ |
| 334 |
--build-type release \ |
| 335 |
--install-ci-deps \ |
| 336 |
--install-boost \ |
| 337 |
--boost-prefix $(pwd) \ |
| 338 |
--install \ |
| 339 |
--install-prefix $(pwd)/dist |
| 340 |
- uses: actions/upload-artifact@v3 |
| 341 |
with: |
| 342 |
name: emscripten |
| 343 |
path: | |
| 344 |
dist |
| 345 |
|
| 346 |
publish-npm: |
| 347 |
name: publish to NPM |
| 348 |
needs: [ |
| 349 |
nodejs, |
| 350 |
emscripten, |
| 351 |
python, |
| 352 |
cxx |
| 353 |
] |
| 354 |
runs-on: ubuntu-22.04 |
| 355 |
steps: |
| 356 |
- uses: actions/checkout@v3 |
| 357 |
with: |
| 358 |
fetch-depth: 0 |
| 359 |
- uses: actions/download-artifact@v3 |
| 360 |
with: |
| 361 |
path: prebuilds |
| 362 |
- name: Setup Node |
| 363 |
uses: actions/setup-node@v3 |
| 364 |
with: |
| 365 |
node-version: '14.x' |
| 366 |
- name: Publish node.js library |
| 367 |
shell: bash |
| 368 |
env: |
| 369 |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 370 |
run: | |
| 371 |
# add readme to npm package |
| 372 |
cp README* src/npmpackage |
| 373 |
|
| 374 |
# bump version |
| 375 |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then |
| 376 |
version="${GITHUB_REF##*/}" |
| 377 |
else |
| 378 |
version="$(date '+%Y.%-m.%-d')-dev.${GITHUB_RUN_NUMBER}" |
| 379 |
is_dev="1" |
| 380 |
fi |
| 381 |
|
| 382 |
jq --arg version "${version}" '.version = $version' src/npmpackage/package.json > package.json.tmp |
| 383 |
mv package.json.tmp src/npmpackage/package.json |
| 384 |
|
| 385 |
mkdir -p src/npmpackage/build/Release |
| 386 |
mv prebuilds/*-nodejs-* src/npmpackage/build/Release |
| 387 |
mv prebuilds/emscripten/ocl.js src/npmpackage/build |
| 388 |
cd src/npmpackage |
| 389 |
npm install |
| 390 |
npm run build-emscripten |
| 391 |
if [ "${is_dev}" == "1" ]; then |
| 392 |
npm publish --access public --tag dev |
| 393 |
else |
| 394 |
npm publish --access public |
| 395 |
fi |
| 396 |
publish-pypi: |
| 397 |
name: publish to PyPi |
| 398 |
needs: [ |
| 399 |
nodejs, |
| 400 |
emscripten, |
| 401 |
python, |
| 402 |
cxx |
| 403 |
] |
| 404 |
runs-on: ubuntu-22.04 |
| 405 |
steps: |
| 406 |
- uses: actions/checkout@v3 |
| 407 |
with: |
| 408 |
fetch-depth: 0 |
| 409 |
- uses: actions/download-artifact@v3 |
| 410 |
with: |
| 411 |
path: prebuilds |
| 412 |
- name: prepare |
| 413 |
shell: bash |
| 414 |
run: | |
| 415 |
mkdir dist |
| 416 |
mv prebuilds/*-python-*/* dist |
| 417 |
- name: Publish wheels to Test PyPI |
| 418 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 419 |
with: |
| 420 |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 421 |
repository_url: https://test.pypi.org/legacy/ |
| 422 |
- name: Publish wheels to PyPI |
| 423 |
if: startsWith(github.ref, 'refs/tags') |
| 424 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 425 |
with: |
| 426 |
password: ${{ secrets.PYPI_API_TOKEN }} |
| 427 |
publish-github: |
| 428 |
name: publish to Github |
| 429 |
if: startsWith(github.ref, 'refs/tags/') |
| 430 |
needs: [ |
| 431 |
nodejs, |
| 432 |
emscripten, |
| 433 |
python, |
| 434 |
cxx |
| 435 |
] |
| 436 |
runs-on: ubuntu-22.04 |
| 437 |
steps: |
| 438 |
- uses: actions/checkout@v3 |
| 439 |
with: |
| 440 |
fetch-depth: 0 |
| 441 |
- uses: actions/download-artifact@v3 |
| 442 |
with: |
| 443 |
path: prebuilds |
| 444 |
- name: prepare |
| 445 |
shell: bash |
| 446 |
run: | |
| 447 |
mkdir dist |
| 448 |
zip -r dist/linux-cxx-x86_64.zip prebuilds/linux-cxx-x86_64 |
| 449 |
zip -r dist/macos-cxx-arm64.zip prebuilds/macos-cxx-arm64 |
| 450 |
zip -r dist/macos-cxx-x86_64.zip prebuilds/macos-cxx-x86_64 |
| 451 |
zip -r dist/windows-cxx-ia32.zip prebuilds/windows-cxx-ia32 |
| 452 |
zip -r dist/windows-cxx-x64.zip prebuilds/windows-cxx-x64 |
| 453 |
- name: Release |
| 454 |
uses: softprops/action-gh-release@v1 |
| 455 |
with: |
| 456 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 457 |
files: | |
| 458 |
dist/* |