diff --git a/native/ecto_libsql/.cargo/config.toml b/.cargo/config.toml similarity index 100% rename from native/ecto_libsql/.cargo/config.toml rename to .cargo/config.toml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01781a0..a300507 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,15 @@ on: tags: - "v*" workflow_dispatch: + inputs: + test_only: + description: "Test run (skip publishing release)" + required: false + default: "false" + type: choice + options: + - "false" + - "true" permissions: contents: write @@ -19,11 +28,23 @@ jobs: nif: ["2.15"] job: - { target: aarch64-apple-darwin, os: macos-15 } - - { target: x86_64-apple-darwin, os: macos-15-intel } - - { 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: x86_64-apple-darwin, os: macos-15 } + - { + 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: x86_64-unknown-linux-gnu, os: ubuntu-24.04 } - - { target: x86_64-unknown-linux-musl, os: ubuntu-24.04, use-cross: true } + - { + target: x86_64-unknown-linux-musl, + os: ubuntu-24.04, + use-cross: true, + } steps: - name: Checkout code @@ -38,27 +59,27 @@ jobs: echo "::error::Failed to extract version from mix.exs" exit 1 fi - + # Check if this is a tag push or workflow_dispatch if [[ "$GITHUB_REF" == refs/tags/* ]]; then # Extract git tag from GITHUB_REF_NAME (e.g., "v0.8.10") GIT_TAG="${GITHUB_REF_NAME}" - + # Validate that git tag matches mix.exs version # Git tag should be v, so strip the 'v' prefix for comparison TAG_VERSION="${GIT_TAG#v}" - + if [ "$VERSION" != "$TAG_VERSION" ]; then echo "::error::Version mismatch: mix.exs version is '$VERSION' but git tag is '$GIT_TAG' (without 'v': '$TAG_VERSION')" exit 1 fi - + echo "✓ Version validation passed: mix.exs version '$VERSION' matches git tag '$GIT_TAG'" else # workflow_dispatch or other non-tag trigger echo "ℹ Using version from mix.exs: '$VERSION' (not a tag push)" fi - + echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV - name: Install Rust toolchain @@ -69,16 +90,13 @@ jobs: - name: Build the project id: build-crate uses: philss/rustler-precompiled-action@v1.1.4 - env: - CARGO_BUILD_TARGET: ${{ matrix.job.target }} with: project-name: ecto_libsql project-version: ${{ env.PROJECT_VERSION }} target: ${{ matrix.job.target }} nif-version: ${{ matrix.nif }} - use-cross: ${{ matrix.job.use-cross }} - cross-version: "from-source" - project-dir: "native/ecto_libsql" + use-cross: ${{ matrix.job.use-cross && 'true' || '' }} + project-dir: "." - name: Artifact upload uses: actions/upload-artifact@v6 @@ -91,4 +109,4 @@ jobs: with: files: | ${{ steps.build-crate.outputs.file-path }} - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') && inputs.test_only != 'true' diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..8753ab9 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,7 @@ +# Cross-compilation configuration for the `cross` tool. +# See: https://hexdocs.pm/rustler_precompiled/precompilation_guide.html + +[build.env] +passthrough = [ + "RUSTLER_NIF_VERSION" +]