Skip to content

v0.20251027.0

v0.20251027.0 #366

Workflow file for this run

name: CD
on:
release:
types: [created]
workflow_dispatch:
permissions:
contents: write
id-token: write
jobs:
libraries:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: 'Windows static library (Intel) (Release)'
os: windows-2022
arch: amd64
build_type: Release
shared_libs: OFF
- name: 'Windows shared library (Intel) (Release)'
os: windows-2022
arch: amd64
build_type: Release
shared_libs: ON
- name: 'Windows shared library (Intel) (Debug)'
os: windows-2022
arch: amd64
build_type: Debug
shared_libs: ON
- name: 'Windows static library (ARM) (Release)'
os: windows-11-arm
arch: amd64_arm64
build_type: Release
shared_libs: OFF
- name: 'Windows shared library (ARM) (Release)'
os: windows-11-arm
arch: amd64_arm64
build_type: Release
shared_libs: ON
- name: 'Windows shared library (ARM) (Debug)'
os: windows-11-arm
arch: amd64_arm64
build_type: Debug
shared_libs: ON
- name: 'Linux static library (Intel)'
os: ubuntu-22.04
build_type: Release
shared_libs: OFF
- name: 'Linux shared library (Intel)'
os: ubuntu-22.04
build_type: Release
shared_libs: ON
- name: 'Linux static library (ARM)'
os: ubuntu-22.04-arm
build_type: Release
shared_libs: OFF
- name: 'Linux shared library (ARM)'
os: ubuntu-22.04-arm
build_type: Release
shared_libs: ON
- name: 'macOS static library (Intel)'
os: macos-15-intel
build_type: Release
shared_libs: OFF
- name: 'macOS shared library (Intel)'
os: macos-15-intel
build_type: Release
shared_libs: ON
- name: 'macOS static library (ARM)'
os: macos-15
build_type: Release
shared_libs: OFF
- name: 'macOS shared library (ARM)'
os: macos-15
build_type: Release
shared_libs: ON
env:
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_DEBUG: -1
BUILDCACHE_LOG_FILE: ""
steps:
- name: Set the timezone to New Zealand
uses: szenius/[email protected]
with:
timezoneWindows: 'New Zealand Standard Time'
timezoneLinux: 'Pacific/Auckland'
timezoneMacos: 'Pacific/Auckland'
- name: Check out libOpenCOR
uses: actions/checkout@v4
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: opencor/buildcache-action@v1
with:
cache_key: cd-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.shared_libs }}
- name: Configure MSVC
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Configure libOpenCOR
run: cmake -G Ninja -S . -B build -DBUILD_TYPE=${{ matrix.build_type }} -DCODE_ANALYSIS=OFF -DCODE_COVERAGE=OFF -DDOCUMENTATION=OFF -DJAVASCRIPT_BINDINGS=OFF -DMEMORY_CHECKS=OFF -DPYTHON_BINDINGS=OFF -DPYTHON_UNIT_TESTING=OFF -DSHARED_LIBS=${{ matrix.shared_libs }} -DUNIT_TESTING=OFF
- name: Build libOpenCOR
run: cmake --build build
- name: Package libOpenCOR
run: |
cd build
cpack
- name: Upload libOpenCOR artifacts
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ./build/libOpenCOR-*
- name: Release libOpenCOR
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v2
with:
files: ./build/libOpenCOR-*
python_wheels:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: 'Windows Python wheels (Intel)'
os: windows-2022
arch: amd64
- name: 'Windows Python wheels (ARM)'
os: windows-11-arm
arch: amd64_arm64
- name: 'Linux Python wheels (Intel)'
os: ubuntu-22.04
- name: 'Linux Python wheels (ARM)'
os: ubuntu-22.04-arm
- name: 'macOS Python wheels (Intel)'
os: macos-15-intel
- name: 'macOS Python wheels (ARM)'
os: macos-15
steps:
- name: Set the timezone to New Zealand
uses: szenius/[email protected]
with:
timezoneWindows: 'New Zealand Standard Time'
timezoneLinux: 'Pacific/Auckland'
timezoneMacos: 'Pacific/Auckland'
- name: Check out libOpenCOR
uses: actions/checkout@v4
- name: Free disk space
if: ${{ runner.os == 'Linux' }}
run: |
sudo rm -rf /opt/hostedtoolcache
sudo docker image prune --all --force
- name: Configure MSVC
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build Python wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: auto64
CIBW_BUILD: 'cp*'
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=13.0
# Note #1: the value of CIBW_ENVIRONMENT_MACOS must be in sync with that of MACOS_DEPLOYMENT_TARGET in
# CMakelists.txt.
# Note #2: for some reasons, we need to specify the minor version, hence using 13.0 rather than 13.
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_34
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_34
CIBW_SKIP: 'cp38* cp39* cp*t-* *musllinux*'
- name: Upload Python wheel artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ./wheelhouse/*.whl
- name: Release Python wheels
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v2
with:
files: ./wheelhouse/*.whl
python_pypi:
needs: [python_wheels]
name: Publish to PyPI
runs-on: ubuntu-22.04
environment: pypi
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Download Python wheels
uses: actions/download-artifact@v5
with:
pattern: "*Python wheels*"
path: ./dist
merge-multiple: true
- name: Publish Python wheels
uses: pypa/gh-action-pypi-publish@release/v1
webassembly:
name: WebAssembly
runs-on: ubuntu-22.04
env:
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_COMPRESS_FORMAT: ZSTD
BUILDCACHE_DEBUG: -1
BUILDCACHE_LOG_FILE: ""
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Set the timezone to New Zealand
uses: szenius/[email protected]
with:
timezoneLinux: 'Pacific/Auckland'
- name: Check out libOpenCOR
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- name: Update npm
# Install the latest version of npm since we need npm 11.5.1 or later to publish to npm using OIDC (see
# https://docs.npmjs.com/trusted-publishers).
run: npm install -g npm@latest
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install buildcache
uses: opencor/buildcache-action@v1
with:
cache_key: cd-webassembly
- name: Install Emscripten
uses: mymindstorm/setup-emsdk@v14
- name: Configure libOpenCOR
run: cmake -G Ninja -S . -B build -DBUILD_TYPE=Release -DCODE_ANALYSIS=OFF -DCODE_COVERAGE=OFF -DDOCUMENTATION=OFF -DJAVASCRIPT_BINDINGS=ON -DJAVASCRIPT_UNIT_TESTING=OFF -DMEMORY_CHECKS=OFF -DPYTHON_BINDINGS=OFF -DPYTHON_UNIT_TESTING=OFF -DSHARED_LIBS=OFF -DUNIT_TESTING=OFF
- name: Build WebAssembly
run: cmake --build build
- name: Upload WebAssembly artifact
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/upload-artifact@v4
with:
name: WebAssembly
path: ./build/libopencor-*
- name: Release WebAssembly
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: softprops/action-gh-release@v2
with:
files: ./build/libopencor-*
- name: Deploy to https://opencor.ws/libopencor/downloads/wasm
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: milanmk/actions-file-deployer@master
with:
remote-protocol: sftp
remote-host: ${{ secrets.REMOTE_HOST }}
remote-user: ${{ secrets.REMOTE_USER }}
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
local-path: ./build/src/bindings/javascript/build/src/wasm
remote-path: /home/www/opencor.ws/libopencor/downloads/wasm
sync: full
- name: Publish libOpenCOR
# To publish using OIDC implies automatic provenance generation, so no need to specify --provenance (see
# https://docs.npmjs.com/trusted-publishers). Provenance requires "repository.url" in package.json to match the
# repository from which we are publishing. In our case, it means that we can only publish to npm from the
# "opencor/libopencor" repository. (Provenance can be disabled, but we prefer to be open.)
run: |
cd build/src/bindings/javascript/build/src
npm publish --access public --no-git-checks