Artifacts #282
Workflow file for this run
This file contains hidden or 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: Artifacts | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| inputs: | |
| run_full_matrix: | |
| description: Build all additional architectures (aarch64, universal2, etc.) | |
| type: boolean | |
| default: true | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| binary_linux: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: ./.github/actions/setup-rust | |
| with: | |
| target: aarch64-unknown-linux-gnu | |
| version: stable | |
| - run: | | |
| sudo apt-get update && sudo apt-get install -y g++-aarch64-linux-gnu libssl-dev | |
| mkdir .cargo | |
| echo -e "[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> .cargo/config.toml | |
| - run: cargo build --release --no-default-features | |
| working-directory: ./cli | |
| - run: find /usr | |
| - run: cargo build --release --target aarch64-unknown-linux-gnu --no-default-features | |
| working-directory: ./cli | |
| env: | |
| BINDGEN_EXTRA_CLANG_ARGS: --sysroot /usr/aarch64-linux-gnu | |
| PKG_CONFIG_LIBDIR: $SYSROOT/usr/lib/pkgconfig:$SYSROOT/usr/share/pkgconfig | |
| PKG_CONFIG_SYSROOT_DIR: $SYSROOT | |
| PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ontoenv_x86_64_linux_gnu_${{ github.run_attempt }} | |
| path: target/release/ontoenv | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ontoenv_aarch64_linux_gnu_${{ github.run_attempt }} | |
| path: target/aarch64-unknown-linux-gnu/release/ontoenv | |
| - run: mv target/release/ontoenv ontoenv_${{ github.event.release.tag_name }}_x86_64_linux_gnu | |
| if: github.event_name == 'release' | |
| - uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ontoenv_${{ github.event.release.tag_name }}_x86_64_linux_gnu | |
| if: github.event_name == 'release' | |
| binary_mac: | |
| 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@v3 | |
| with: | |
| submodules: true | |
| - uses: ./.github/actions/setup-rust | |
| with: | |
| target: aarch64-apple-darwin | |
| version: stable | |
| - run: cargo build --release | |
| working-directory: ./cli | |
| - run: cargo build --release --target aarch64-apple-darwin | |
| working-directory: ./cli | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ontoenv_x86_64_apple_${{ github.run_attempt }} | |
| path: target/release/ontoenv | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ontoenv_aarch64_apple_${{ github.run_attempt }} | |
| path: target/aarch64-apple-darwin/release/ontoenv | |
| - run: mv target/release/ontoenv ontoenv_${{ github.event.release.tag_name }}_x86_64_apple | |
| if: github.event_name == 'release' | |
| - run: mv target/aarch64-apple-darwin/release/ontoenv ontoenv_${{ github.event.release.tag_name }}_aarch64_apple | |
| if: github.event_name == 'release' | |
| - uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ontoenv_${{ github.event.release.tag_name }}_x86_64_apple | |
| ontoenv_${{ github.event.release.tag_name }}_aarch64_apple | |
| if: github.event_name == 'release' | |
| binary_windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Clean build cache | |
| run: cargo clean | |
| working-directory: ./cli | |
| shell: bash | |
| - run: cargo build --release | |
| working-directory: ./cli | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ontoenv_x86_64_windows_msvc_${{ github.run_attempt }} | |
| path: target/release/ontoenv.exe | |
| - run: mv target/release/ontoenv.exe ontoenv_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe | |
| if: github.event_name == 'release' | |
| - uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ontoenv_${{ github.event.release.tag_name }}_x86_64_windows_msvc.exe | |
| if: github.event_name == 'release' | |
| python_sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - uses: ./.github/actions/setup-rust | |
| with: | |
| version: stable | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: '**/requirements.dev.txt' | |
| - run: pip install -r python/requirements.dev.txt | |
| - run: maturin build -m python/Cargo.toml --features "cli" | |
| - run: pip install --no-index --find-links=target/wheels/ ontoenv | |
| - run: rm -r target/wheels | |
| - run: maturin sdist -m python/Cargo.toml | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyontoenv_dist_${{ github.run_attempt }} | |
| path: target/wheels/*.tar.gz | |
| python_pyontoenv_alias: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: | | |
| VERSION=$(awk ' | |
| /^\[workspace.package\]/ { in_section=1; next } | |
| /^\[/ { if (in_section) exit; in_section=0 } | |
| in_section && $1 ~ /^version/ { | |
| gsub(/"/, "", $3); | |
| print $3; | |
| exit | |
| } | |
| ' Cargo.toml) | |
| echo "ONTOENV_VERSION=$VERSION" >> "$GITHUB_ENV" | |
| - run: pip install build | |
| - run: python -m build | |
| working-directory: ./pyontoenv-shim | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyontoenv_alias_${{ github.run_attempt }} | |
| path: pyontoenv-shim/dist/* | |
| wheel_linux_cross: | |
| runs-on: macos-14 | |
| strategy: | |
| matrix: | |
| arch: [ x86_64, aarch64 ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu | |
| - name: Install zig | |
| run: brew install zig | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Install Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Build Linux ${{ matrix.arch }} wheel (uv+maturin+zig) | |
| working-directory: python | |
| env: | |
| UV_PYTHON_DOWNLOAD_MISSING: 1 | |
| run: | | |
| uv tool run --python 3.12 \ | |
| maturin build \ | |
| --release \ | |
| --target ${{ matrix.arch }}-unknown-linux-gnu \ | |
| --interpreter python3.12 \ | |
| --features "abi3 cli" \ | |
| --compatibility manylinux2014 \ | |
| --zig | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyontoenv_${{ matrix.arch }}_linux_gnu_${{ github.run_attempt }} | |
| path: python/target/wheels/*.whl | |
| wheel_mac: | |
| 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@v3 | |
| with: | |
| submodules: true | |
| - uses: ./.github/actions/setup-rust | |
| with: | |
| target: aarch64-apple-darwin | |
| version: stable | |
| - uses: ./.github/actions/setup-rust | |
| with: | |
| target: x86_64-apple-darwin | |
| version: stable | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: '**/requirements.dev.txt' | |
| - run: pip install -r python/requirements.dev.txt | |
| - run: maturin build --release --features "abi3 cli" | |
| working-directory: ./python | |
| - run: pip install --no-index --find-links=target/wheels/ ontoenv | |
| - run: rm -r target/wheels | |
| - run: maturin build --release --target universal2-apple-darwin --features "abi3 cli" | |
| working-directory: ./python | |
| - run: maturin build --release --target x86_64-apple-darwin --features "abi3 cli" | |
| working-directory: ./python | |
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.run_full_matrix == 'true') | |
| - run: maturin build --release --target aarch64-apple-darwin --features "abi3 cli" | |
| working-directory: ./python | |
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.run_full_matrix == 'true') | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyontoenv_macos_${{ github.run_attempt }} | |
| path: target/wheels/*.whl | |
| wheel_windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - uses: ./.github/actions/setup-rust | |
| with: | |
| version: stable | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| 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 --features "abi3 cli" | |
| working-directory: ./python | |
| - run: pip install --no-index --find-links=target/wheels/ ontoenv | |
| - run: rm -r target/wheels | |
| - run: maturin build --release -m python/Cargo.toml --features "abi3 cli" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyontoenv_windows_${{ github.run_attempt }} | |
| path: target/wheels/*.whl | |
| publish_pypi: | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: publish | |
| url: https://pypi.org/p/ontoenv | |
| permissions: | |
| id-token: write | |
| needs: | |
| - python_sdist | |
| - python_pyontoenv_alias | |
| - wheel_windows | |
| - wheel_mac | |
| - wheel_linux_cross | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: pyontoenv_* | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist | |
| skip-existing: true | |
| password: ${{ secrets.PYPI_TOKEN }} | |
| publish_crates: | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| environment: publish | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Publish ontoenv crate | |
| uses: katyo/publish-crates@v2 | |
| with: | |
| path: './lib' | |
| registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| - name: Publish ontoenv-cli crate | |
| uses: katyo/publish-crates@v2 | |
| with: | |
| path: './cli' | |
| registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| #- name: Wait for crate availability | |
| # if: github.event_name == 'release' | |
| # run: ./.github/scripts/wait_for_crates.sh ontoenv ontoenv-cli | |
| full_archive: | |
| if: github.event_name == 'release' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - run: | | |
| rm -rf .git bench fuzz | |
| zip -r ontoenv_${{ github.event.release.tag_name }}.zip . | |
| tar -czf /tmp/ontoenv_${{ github.event.release.tag_name }}.tar.gz . | |
| mv /tmp/ontoenv_${{ github.event.release.tag_name }}.tar.gz . | |
| - uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| ontoenv_${{ github.event.release.tag_name }}.zip | |
| ontoenv_${{ github.event.release.tag_name }}.tar.gz |