Skip to content

Commit 19fbebf

Browse files
authored
ci: derive the rustler precompiled crate from the calling repository (ash-project#2834)
The build-release job hardcoded igniter_js as the crate name and directory, so every other rustler_precompiled project calling this workflow built the wrong crate on a v* tag. rust-crate-dir did not help, as it was only read by rust-check. build-release now reuses rust-crate-dir for the crate directory, falling back to native/<repository name>, and takes the crate name from the repository name. igniter_js resolves to igniter_js and native/igniter_js exactly as before, and any other project works without configuration. rust-project-name is available for a repository whose crate name differs from its own.
1 parent 789fb61 commit 19fbebf

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/ash-ci.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,16 @@ on:
7373
type: string
7474
default: ""
7575
description: >
76-
Optional path to a single Rust crate to run cargo test, fmt and clippy against.
77-
When empty every Cargo.toml in the repository is discovered automatically.
76+
Optional path to a single Rust crate to run cargo test, fmt and clippy against,
77+
and to build for rustler_precompiled releases.
78+
When empty, checks discover every Cargo.toml in the repository and the release
79+
builds native/<repository name>.
80+
rust-project-name:
81+
type: string
82+
default: ""
83+
description: >
84+
Crate name to build for rustler_precompiled releases.
85+
Defaults to the calling repository's name.
7886
sat-solver:
7987
type: string
8088
default: "Picosat"
@@ -982,18 +990,18 @@ jobs:
982990
prefix-key: v0-precomp
983991
shared-key: ${{ matrix.job.target }}-${{ matrix.nif }}
984992
workspaces: |
985-
native/igniter_js
993+
${{ inputs.rust-crate-dir || format('native/{0}', github.event.repository.name) }}
986994
- name: Build the project
987995
id: build-crate
988996
uses: philss/rustler-precompiled-action@67ed0cc2d6a423e4c4cd9ad651dcc6c90f802cdb # v1.1.5
989997
with:
990-
project-name: igniter_js
998+
project-name: ${{ inputs.rust-project-name || github.event.repository.name }}
991999
project-version: ${{ env.PROJECT_VERSION }}
9921000
target: ${{ matrix.job.target }}
9931001
nif-version: ${{ matrix.nif }}
9941002
use-cross: ${{ matrix.job.use-cross }}
9951003
cross-version: ${{ matrix.job.cross-version || 'v0.2.4' }}
996-
project-dir: "native/igniter_js"
1004+
project-dir: ${{ inputs.rust-crate-dir || format('native/{0}', github.event.repository.name) }}
9971005
cargo-args: ${{ matrix.job.cargo-args }}
9981006

9991007
- name: Artifact upload

0 commit comments

Comments
 (0)