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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
|
name: CD
on:
push:
branches:
- master
- develop
tags:
- v*
release:
types:
- published
jobs:
cxx:
name: ${{ matrix.os_short }} c++ ${{ matrix.architecture }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os_arch: [
"windows-ia32",
"windows-x64",
"macos-x86_64",
"macos-arm64",
"linux-x86_64",
"linux-aarch64",
]
include:
- os_arch: "windows-ia32"
os: "windows-2022"
os_short: "windows"
architecture: "ia32"
cmake_generator_platform: "Win32"
- os_arch: "windows-x64"
os: "windows-2022"
os_short: "windows"
architecture: "x64"
cmake_generator_platform: "x64"
- os_arch: "macos-x86_64"
os: "macos-11.0"
os_short: "macos"
architecture: "x86_64"
- os_arch: "macos-arm64"
os: "macos-11.0"
os_short: "macos"
architecture: "arm64"
- os_arch: linux-x86_64
os: "ubuntu-22.04"
os_short: "linux"
architecture: "x86_64"
docker_image: "dockcross/linux-x64:latest"
- os_arch: linux-aarch64
os: "ubuntu-22.04"
os_short: "linux"
architecture: "aarch64"
docker_image: "dockcross/linux-arm64-lts:latest"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: cxxlib
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
version="$(date '+%Y.%-m.%-d').dev${GITHUB_RUN_NUMBER}"
fi
echo "${version}" > src/git-tag.txt
if [ "${{ matrix.docker_image }}" != "" ]; then
export OCL_DOCKER_IMAGE="${{ matrix.docker_image }}"
fi
if [ "${{ matrix.macos_architecture }}" != "" ]; then
export OCL_MACOS_ARCHITECTURE="${{ matrix.architecture }}"
fi
if [ "${{ matrix.cmake_generator_platform }}" != "" ]; then
export OCL_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}"
fi
./install.sh \
--build-library cxx \
--build-type release \
--install-ci-deps \
--install-boost \
--boost-prefix $(pwd) \
--install \
--install-prefix $(pwd)/dist
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os_short }}-cxx-${{ matrix.architecture }}
path: |
dist
nodejs:
name: ${{ matrix.os_short }} node.js ${{ matrix.architecture }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os_arch: [
"windows-ia32",
"windows-x64",
"macos-x86_64",
"macos-arm64",
"linux-x86_64",
"linux-aarch64",
]
include:
- os_arch: "windows-ia32"
os: "windows-2022"
os_short: "windows"
architecture: "ia32"
cmake_generator_platform: "Win32"
node_architecture: "ia32"
- os_arch: "windows-x64"
os: "windows-2022"
os_short: "windows"
architecture: "x64"
cmake_generator_platform: "x64"
node_architecture: "x64"
- os_arch: "macos-x86_64"
os: "macos-11.0"
os_short: "macos"
architecture: "x86_64"
node_architecture: "x64"
macos_architecture: "x86_64"
- os_arch: "macos-arm64"
os: "macos-11.0"
os_short: "macos"
architecture: "arm64"
node_architecture: "arm64"
macos_architecture: "arm64"
- os_arch: linux-x86_64
os: "ubuntu-22.04"
os_short: "linux"
architecture: "x86_64"
node_architecture: "x64"
- os_arch: linux-aarch64
os: "ubuntu-22.04"
os_short: "linux"
architecture: "aarch64"
node_architecture: "arm64"
docker_image: ghcr.io/prebuild/linux-arm64-lts:latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: nodejslib
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
version="$(date '+%Y.%-m.%-d')-dev.${GITHUB_RUN_NUMBER}"
fi
echo "${version}" > src/git-tag.txt
if [ "${{ matrix.docker_image }}" != "" ]; then
export OCL_DOCKER_IMAGE="${{ matrix.docker_image }}"
# 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
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"
elif [ "${{ matrix.macos_architecture }}" != "" ]; then
export OCL_MACOS_ARCHITECTURE="${{ matrix.macos_architecture }}"
elif [ "${{ matrix.cmake_generator_platform }}" != "" ]; then
export OCL_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}"
fi
./install.sh \
--build-library nodejs \
--build-type release \
--install-ci-deps \
--install-boost \
--boost-prefix $(pwd) \
--node-architecture ${{ matrix.node_architecture }} \
--install \
--install-prefix $(pwd)/dist
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os_short }}-nodejs-${{ matrix.node_architecture }}
path: |
dist
python:
name: ${{ matrix.os_short }} python ${{ matrix.architecture }} cp${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
os_arch: [
"windows-ia32",
"windows-x64",
# "windows-arm64",
"macos-x86_64",
"macos-arm64",
"linux-x86_64",
"linux-aarch64",
]
python_version: [
"37",
"38",
"39",
"310",
"311",
]
exclude:
- os_arch: "macos-arm64"
python_version: "37"
include:
- os_arch: "windows-ia32"
os: "windows-2022"
os_short: "windows"
architecture: "ia32"
boost_architecture: "x86"
cibuildwheel_architecture: "x86"
boost_address_model: "32"
cmake_generator_platform: "Win32"
- os_arch: "windows-x64"
os: "windows-2022"
os_short: "windows"
architecture: "x64"
boost_architecture: "x86"
boost_address_model: "64"
cibuildwheel_architecture: "AMD64"
cmake_generator_platform: "x64"
# - os_arch: "windows-arm64"
# os: "windows-2022"
# os_short: "windows"
# architecture: "arm64"
# boost_architecture: "arm"
# boost_address_model: "64"
# cibuildwheel_architecture: "ARM64"
# cmake_generator_platform: "ARM64"
- os_arch: "macos-x86_64"
os: "macos-11.0"
os_short: "macos"
architecture: "x86_64"
boost_architecture: "x86"
- os_arch: "macos-arm64"
os: "macos-11.0"
os_short: "macos"
architecture: "arm64"
boost_architecture: "arm"
- os_arch: linux-x86_64
os: "ubuntu-22.04"
os_short: "linux"
architecture: "x86_64"
boost_architecture: "x86"
- os_arch: linux-aarch64
os: "ubuntu-22.04"
os_short: "linux"
architecture: "aarch64"
boost_architecture: "arm"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# - name: Cache Boost.Python
# id: cache-boost-python
# uses: actions/cache@v3
# with:
# path: boost-precompiled.tar.gz
# key: boost-1.80.0-${{ matrix.os_short }}-${{ matrix.architecture }}
- name: prepare
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
version="$(date '+%Y.%-m.%-d').dev${GITHUB_RUN_NUMBER}"
fi
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
echo "${version}" > src/git-tag.txt
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: matrix.architecture == 'aarch64'
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.11.2
env:
CIBW_BUILD: "cp${{ matrix.python_version }}-*"
CIBW_PLATFORM: "${{ matrix.os_short }}"
CIBW_BUILD_VERBOSITY: "1"
CIBW_ARCHS_WINDOWS: "${{ matrix.cibuildwheel_architecture }}"
CIBW_ENVIRONMENT_WINDOWS: >
BOOST_ROOT="$(cygpath -w $(pwd))"
OCL_BOOST_ADDRESS_MODEL="${{ matrix.boost_address_model }}"
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}"
CMAKE_GENERATOR="Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}"
CIBW_ENVIRONMENT_PASS_WINDOWS: "BOOST_ROOT OCL_BOOST_ADDRESS_MODEL OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM"
CIBW_ARCHS_MACOS: "${{ matrix.architecture }}"
CIBW_ENVIRONMENT_MACOS: >
BOOST_ROOT="$(pwd)"
OCL_MACOS_ARCHITECTURE="${{ matrix.architecture }}"
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}"
OPENMP_PREFIX_MACOS="/tmp/libomp/libomp/fixed"
CIBW_ENVIRONMENT_PASS_MACOS: "BOOST_ROOT OCL_BOOST_ARCHITECTURE OPENMP_PREFIX_MACOS"
CIBW_ARCHS_LINUX: "${{ matrix.architecture }}"
CIBW_ENVIRONMENT_LINUX: >
BOOST_ROOT="$(pwd)"
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}"
CMAKE_GENERATOR="Unix Makefiles"
CIBW_ENVIRONMENT_PASS_LINUX: "BOOST_ROOT OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR"
# - name: Compress Boost.Python
# shell: bash
# run: |
# if [ -d "boost_1_80_0" ]; then
# tar -czf boost-precompiled.tar.gz boost_1_80_0 || true
# fi
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os_short }}-python-${{ matrix.architecture }}
path: |
./wheelhouse/*.whl
emscripten:
name: emscripten
runs-on: ubuntu-22.04
timeout-minutes: 120
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: emscripten
shell: bash
run: |
./install.sh \
--build-library emscripten \
--build-type release \
--install-ci-deps \
--install-boost \
--boost-prefix $(pwd) \
--install \
--install-prefix $(pwd)/dist
- uses: actions/upload-artifact@v3
with:
name: emscripten
path: |
dist
publish-npm:
name: publish to NPM
needs: [
nodejs,
emscripten,
python,
cxx
]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
path: prebuilds
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Publish node.js library
shell: bash
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# add readme to npm package
cp README* src/npmpackage
# bump version
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
version="$(date '+%Y.%-m.%-d')-dev.${GITHUB_RUN_NUMBER}"
is_dev="1"
fi
jq --arg version "${version}" '.version = $version' src/npmpackage/package.json > package.json.tmp
mv package.json.tmp src/npmpackage/package.json
mkdir -p src/npmpackage/build/Release
mv prebuilds/*-nodejs-* src/npmpackage/build/Release
mv prebuilds/emscripten/ocl.js src/npmpackage/build
cd src/npmpackage
npm install
npm run build-emscripten
if [ "${is_dev}" == "1" ]; then
npm publish --access public --tag dev
else
npm publish --access public
fi
publish-pypi:
name: publish to PyPi
needs: [
nodejs,
emscripten,
python,
cxx
]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
path: prebuilds
- name: prepare
shell: bash
run: |
mkdir dist
mv prebuilds/*-python-*/* dist
- name: Publish wheels to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish wheels to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
publish-github:
name: publish to Github
if: startsWith(github.ref, 'refs/tags/')
needs: [
nodejs,
emscripten,
python,
cxx
]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
path: prebuilds
- name: prepare
shell: bash
run: |
mkdir dist
zip -r dist/linux-cxx-x86_64.zip prebuilds/linux-cxx-x86_64
zip -r dist/macos-cxx-arm64.zip prebuilds/macos-cxx-arm64
zip -r dist/macos-cxx-x86_64.zip prebuilds/macos-cxx-x86_64
zip -r dist/windows-cxx-ia32.zip prebuilds/windows-cxx-ia32
zip -r dist/windows-cxx-x64.zip prebuilds/windows-cxx-x64
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
dist/*
|