Merge branch 'release/0.3.3' #70
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: Build precompiled NIFs | |
| 'on': | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| jobs: | |
| build_release: | |
| name: 'NIF ${{ matrix.nif }} - ${{ matrix.job.target }} (${{ matrix.job.os }})' | |
| runs-on: '${{ matrix.job.os }}' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| nif: | |
| - '2.17' | |
| job: | |
| - target: arm-unknown-linux-gnueabihf | |
| os: ubuntu-24.04 | |
| use-cross: true | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04 | |
| use-cross: true | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-24.04 | |
| use-cross: true | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| - target: riscv64gc-unknown-linux-gnu | |
| os: ubuntu-24.04 | |
| use-cross: true | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-24.04 | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-24.04 | |
| use-cross: true | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Extract project version and branch/tag | |
| shell: bash | |
| run: | | |
| # Get the project version from cozodb.app.src | |
| echo "PROJECT_VERSION=$(sed -n 's/.*{vsn, "\([^"]*\)".*/\1/p' | |
| src.cozodb.app.src | head -n1)" >> $GITHUB_ENV | |
| # Determine if it's a tag or a branch | |
| if [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
| BRANCH_OR_TAG="${GITHUB_REF#refs/tags/}" | |
| else | |
| BRANCH_OR_TAG="${GITHUB_REF#refs/heads/}" | |
| fi | |
| echo "BRANCH_OR_TAG=$BRANCH_OR_TAG" >> $GITHUB_ENV | |
| - name: Install build dependencies | |
| run: sudo apt-get update && sudo apt-get install -y build-essential clang libclang-dev pkg-config | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| target: '${{ matrix.job.target }}' | |
| - name: Build the project | |
| id: build-crate | |
| uses: philss/rustler-precompiled-action@v1.1.4 | |
| with: | |
| project-name: cozodb | |
| project-version: '${{ env.PROJECT_VERSION }}' | |
| target: '${{ matrix.job.target }}' | |
| nif-version: '${{ matrix.nif }}' | |
| use-cross: '${{ matrix.job.use-cross }}' | |
| project-dir: native/cozodb | |
| - name: Rename Artifact with Branch & Version | |
| shell: bash | |
| run: | | |
| ORIGINAL_NAME="${{ steps.build-crate.outputs.file-name }}" | |
| NEW_NAME="cozodb-${{ env.BRANCH_OR_TAG }}-${{ env.PROJECT_VERSION }}-${{ matrix.job.target }}.tar.gz" | |
| mv "${{ steps.build-crate.outputs.file-path }}" "$NEW_NAME" | |
| echo "RENAMED_ARTIFACT=$NEW_NAME" >> $GITHUB_ENV | |
| - name: Artifact upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: '${{ env.RENAMED_ARTIFACT }}' | |
| path: '${{ env.RENAMED_ARTIFACT }}' | |
| - name: Publish archives and packages | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ${{ env.RENAMED_ARTIFACT }} | |
| if: 'startsWith(github.ref, ''refs/tags/'')' |