Skip to content

Add --standalone flag #321

Add --standalone flag

Add --standalone flag #321

Workflow file for this run

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}" > VERSION
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
.github/scripts/ci_deps.sh
./install_boost.sh
./install.sh \
--standalone \
--build-type release \
--boost-prefix $(pwd) \
--install \
--install-prefix $(pwd)/dist \
cxx
- 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}" > VERSION
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
.github/scripts/ci_deps.sh
./install_boost.sh
export OPENMP_PREFIX_MACOS="/tmp/libomp/libomp/fixed"
./install.sh \
--build-type release \
--boost-prefix $(pwd) \
--standalone \
--node-architecture ${{ matrix.node_architecture }} \
--install \
--install-prefix $(pwd)/dist \
nodejs
- 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}" > VERSION
- 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 }}"
USE_STANDALONE="ON"
CIBW_ENVIRONMENT_PASS_WINDOWS: "BOOST_ROOT OCL_BOOST_ADDRESS_MODEL OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM USE_STANDALONE"
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"
USE_STANDALONE="ON"
CIBW_ENVIRONMENT_PASS_MACOS: "BOOST_ROOT OCL_BOOST_ARCHITECTURE OPENMP_PREFIX_MACOS USE_STANDALONE"
CIBW_ARCHS_LINUX: "${{ matrix.architecture }}"
CIBW_ENVIRONMENT_LINUX: >
BOOST_ROOT="$(pwd)"
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}"
CMAKE_GENERATOR="Unix Makefiles"
USE_STANDALONE="ON"
CIBW_ENVIRONMENT_PASS_LINUX: "BOOST_ROOT OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR USE_STANDALONE"
# - 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: |
.github/scripts/ci_deps.sh
./install_boost.sh
./install.sh \
--build-type release \
--boost-prefix $(pwd) \
--standalone \
--install \
--install-prefix $(pwd)/dist \
emscripten
- 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/*