Build #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# cf. https://github.com/oxigraph/oxigraph/blob/main/.github/workflows/artifacts.yml | |
jobs: | |
npm_tarball: | |
name: 🦊 Build npm package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install wasm-pack for JS | |
run: cargo install wasm-pack | |
- name: Setup node for JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
cache: npm | |
cache-dependency-path: "./js/package.json" | |
- name: Build npm package | |
run: npm run pack | |
working-directory: ./js | |
- name: Upload tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: curies_npm | |
path: ./js/pkg | |
- run: npm run release | |
working-directory: ./js | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
if: github.event_name == 'release' | |
publish_crates: | |
name: 📦️ Publish crates to crates.io | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update | |
- run: cargo login $CRATES_IO_TOKEN | |
env: | |
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
- run: cargo publish | |
working-directory: ./lib | |
wheel_linux: | |
name: 🐍🐧 Build wheel for Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
architecture: [ "x86_64", "aarch64" ] | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/${{ matrix.architecture }} | |
if: github.event_name == 'release' && matrix.architecture != 'x86_64' | |
- run: sed 's/%arch%/${{ matrix.architecture }}/g' .github/workflows/manylinux_build.sh | sed 's/%for_each_version%/${{ github.event_name == 'release' || '' }}/g' > .github/workflows/manylinux_build_script.sh | |
- run: docker run -v "$(pwd)":/workdir --platform linux/${{ matrix.architecture }} quay.io/pypa/manylinux2014_${{ matrix.architecture }} /bin/bash /workdir/.github/workflows/manylinux_build_script.sh | |
if: github.event_name == 'release' || matrix.architecture == 'x86_64' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: curies_wheel_${{ matrix.architecture }}_linux | |
path: target/wheels/*.whl | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
packages-dir: target/wheels | |
if: github.event_name == 'release' | |
wheel_linux_musl: | |
name: 🐍🐧 Build wheel for MUSL Linux | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
architecture: | |
- "x86_64" | |
# - "aarch64" # Takes too long (1h30) | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/${{ matrix.architecture }} | |
if: github.event_name == 'release' && matrix.architecture != 'x86_64' | |
- run: sed 's/%arch%/${{ matrix.architecture }}/g' .github/workflows/musllinux_build.sh | sed 's/%for_each_version%/${{ github.event_name == 'release' || '' }}/g' > .github/workflows/musllinux_build_script.sh | |
- run: docker run -v "$(pwd)":/workdir --platform linux/${{ matrix.architecture }} quay.io/pypa/musllinux_1_1_${{ matrix.architecture }} /bin/bash /workdir/.github/workflows/musllinux_build_script.sh | |
if: github.event_name == 'release' || matrix.architecture == 'x86_64' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: curies_wheel_${{ matrix.architecture }}_linux_musl | |
path: target/wheels/*.whl | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
packages-dir: target/wheels | |
if: github.event_name == 'release' | |
wheel_mac: | |
name: 🐍🍎 Build wheel for MacOS | |
runs-on: macos-latest | |
env: | |
DEVELOPER_DIR: '/Applications/Xcode.app/Contents/Developer' | |
SDKROOT: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' | |
MACOSX_DEPLOYMENT_TARGET: '10.14' | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update && rustup target add aarch64-apple-darwin | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pip | |
cache-dependency-path: '**/requirements.dev.txt' | |
- run: pip install -r python/requirements.dev.txt | |
- run: maturin build --release -m python/Cargo.toml | |
- run: pip install --no-index --find-links=target/wheels/ curies-rs | |
- run: rm -r target/wheels | |
- run: maturin build --release --target universal2-apple-darwin -m python/Cargo.toml | |
- run: maturin build --release -m python/Cargo.toml | |
if: github.event_name == 'release' | |
- run: maturin build --release --target aarch64-apple-darwin -m python/Cargo.toml | |
if: github.event_name == 'release' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: curies_wheel_universal2_mac | |
path: target/wheels/*.whl | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
packages-dir: target/wheels | |
if: github.event_name == 'release' | |
wheel_windows: | |
name: 🐍🪟 Build wheel for Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: pip | |
cache-dependency-path: '**/requirements.dev.txt' | |
- run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse | |
- run: pip install -r python/requirements.dev.txt | |
- run: maturin build --release -m python/Cargo.toml | |
- run: pip install --no-index --find-links=target/wheels/ curies-rs | |
- run: rm -r target/wheels | |
- run: maturin build --release -m python/Cargo.toml | |
- run: maturin sdist -m python/Cargo.toml | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: curies_wheel_x86_64_windows | |
path: target/wheels/*.whl | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
packages-dir: target/wheels | |
if: github.event_name == 'release' |