Ci #12
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: Release | |
| on: | |
| pull_request: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-rust: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Package crate | |
| run: cargo package -p sdk-core --allow-dirty | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: rust-crate | |
| path: target/package/sdk-core-*.crate | |
| build-python: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.11', '3.12', '3.13', '3.14'] | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| - x86_64-unknown-linux-musl | |
| - aarch64-unknown-linux-musl | |
| # Placeholder for future macOS support: | |
| # - aarch64-apple-darwin | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| cross: false | |
| - target: aarch64-unknown-linux-gnu | |
| cross: true | |
| - target: x86_64-unknown-linux-musl | |
| cross: true | |
| - target: aarch64-unknown-linux-musl | |
| cross: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install maturin | |
| run: pip install "maturin>=1.5,<2.0" | |
| - name: Install Zig | |
| if: matrix.cross | |
| uses: goto-bus-stop/setup-zig@v2 | |
| - name: Build wheel | |
| run: | | |
| maturin build --release \ | |
| --strip \ | |
| --target ${{ matrix.target }} \ | |
| ${{ matrix.cross && '--zig' || '' }} \ | |
| -i python${{ matrix.python-version }} \ | |
| --out dist/ | |
| - name: Build sdist | |
| if: matrix.target == 'x86_64-unknown-linux-gnu' && matrix.python-version == '3.11' | |
| run: maturin sdist --out dist/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-${{ matrix.target }}-py${{ matrix.python-version }} | |
| path: dist/* | |
| build-node: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - x86_64-unknown-linux-gnu | |
| - aarch64-unknown-linux-gnu | |
| - x86_64-unknown-linux-musl | |
| - aarch64-unknown-linux-musl | |
| # Placeholder for future macOS support: | |
| # - aarch64-apple-darwin | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| cross: false | |
| - target: aarch64-unknown-linux-gnu | |
| cross: true | |
| - target: x86_64-unknown-linux-musl | |
| cross: true | |
| - target: aarch64-unknown-linux-musl | |
| cross: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Zig | |
| if: matrix.cross | |
| uses: goto-bus-stop/setup-zig@v2 | |
| - name: Install cargo-zigbuild | |
| if: matrix.cross | |
| run: cargo install cargo-zigbuild | |
| - name: Install npm dependencies | |
| working-directory: npm | |
| run: npm install | |
| - name: Build native module | |
| working-directory: npm | |
| run: | | |
| npx napi build --release \ | |
| --platform \ | |
| --target ${{ matrix.target }} \ | |
| --cargo-cwd ../crates/node | |
| - name: Strip debug symbols | |
| run: | | |
| if [ "${{ matrix.cross }}" = "true" ]; then | |
| # Use llvm-strip for cross-compiled targets (available on ubuntu runners) | |
| llvm-strip npm/index.*.node | |
| else | |
| strip npm/index.*.node | |
| fi | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: node-${{ matrix.target }} | |
| path: npm/index.*.node | |
| release: | |
| needs: [build-rust, build-python, build-node] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| merge-multiple: true | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/**/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-beta') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |