-
Notifications
You must be signed in to change notification settings - Fork 0
Restructure into a cargo workspace and refresh GitHub Actions #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ec334c1
chore: files changed crates/template/examples/basic.rs,examples/basic…
senamakel 911416d
chore(manifest): restructure Cargo.toml as a virtual workspace
senamakel dfeda40
chore(template-bus): update Cargo.toml with new dependency
senamakel 452ef86
feat(template-bus): add greeting, names, and version modules
senamakel f919baf
fix(version): correct test assertion for version comparison
senamakel 234ec1e
fix(version): handle missing version field in template parsing
senamakel 69e57dc
chore(template): add missing Cargo.toml for the template crate
senamakel 8a21d3e
fix(template): restore missing tinybus module files
senamakel bc663b5
chore(template): remove unused example files and simplify greeting mo…
senamakel e50aff0
fix(example): correct GitHub release verification example
senamakel 8c6d3d9
chore(deps): rename rust-template to template and add template-bus de…
senamakel 30f1afc
fix(template): convert method and interface comparisons to owned strings
senamakel dba78af
test(greeting): reformat assertions for readability
senamakel 0e9c452
docs(template-bus): add README documentation for the crate
senamakel e5cf2d4
chore(deps): remove version pin on workspace-internal dependency
senamakel da89b36
fix(ci): update CI workflow to use latest actions
senamakel 31730d5
chore(ci): pin third-party actions to commit SHAs and switch to works…
senamakel a609343
ci: switch GitHub Actions pins from commit SHAs to version tags
senamakel 39f3e24
fix(ci): update source root and expand workspace coverage
senamakel f6af904
chore(docs): rename rust-template references to template
senamakel 928a436
chore: files changed README.md
senamakel 0ab379c
docs(AGENTS.md, tinybus_module/README.md): update project structure a…
senamakel 2bdb476
chore(claude): allow cargo run with a package selector
senamakel 3dc4594
chore(deny): allow wildcard paths for unpublished workspace crates
senamakel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,12 @@ concurrency: | |
| permissions: | ||
| contents: write | ||
|
|
||
| env: | ||
| # The workspace member that ships as the loadable module. Its package name is | ||
| # the artifact name and the library name; `crates/template-bus` rides along on | ||
| # the same inherited version and is not packaged separately. | ||
| RELEASE_PACKAGE: template | ||
|
|
||
| jobs: | ||
| prepare: | ||
| name: Prepare release | ||
|
|
@@ -33,13 +39,15 @@ jobs: | |
| - uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: true | ||
| submodules: recursive | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: rustfmt, clippy | ||
|
|
||
| - uses: taiki-e/install-action@cargo-llvm-cov | ||
| - uses: taiki-e/install-action@v2 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| with: | ||
| tool: cargo-llvm-cov | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
|
|
@@ -70,8 +78,10 @@ jobs: | |
| set -euo pipefail | ||
|
|
||
| metadata="$(cargo metadata --format-version 1 --no-deps)" | ||
| crate_name="$(jq -r '.packages[0].name' <<< "$metadata")" | ||
| current_version="$(jq -r '.packages[0].version' <<< "$metadata")" | ||
| crate_name="$(jq -r --arg name "$RELEASE_PACKAGE" \ | ||
| '.packages[] | select(.name == $name) | .name' <<< "$metadata")" | ||
| current_version="$(jq -r --arg name "$RELEASE_PACKAGE" \ | ||
| '.packages[] | select(.name == $name) | .version' <<< "$metadata")" | ||
| if [[ -z "$crate_name" || "$crate_name" == "null" ]]; then | ||
| echo "Could not resolve the crate name" >&2 | ||
| exit 1 | ||
|
|
@@ -114,7 +124,7 @@ jobs: | |
| fi | ||
| tagged_version="$( | ||
| git show "${tag}:Cargo.toml" \ | ||
| | sed -n 's/^version = "\([^"]*\)"/\1/p' \ | ||
| | sed -n '/^\[workspace\.package\]/,/^\[/ s/^version = "\([^"]*\)"/\1/p' \ | ||
| | head -n 1 | ||
| )" | ||
| if [[ "$tagged_version" != "$current_version" ]]; then | ||
|
|
@@ -140,8 +150,20 @@ jobs: | |
| NEXT_VERSION: ${{ steps.version.outputs.next_version }} | ||
| run: | | ||
| set -euo pipefail | ||
| perl -0pi -e 's/(\[package\][\s\S]*?\nversion = ")[^"]+(")/$1$ENV{NEXT_VERSION}$2/' Cargo.toml | ||
| cargo update -p "$CRATE_NAME" --precise "$NEXT_VERSION" | ||
| # One version for the whole workspace: every member inherits it with | ||
| # `version.workspace = true`, so this is the only edit needed. | ||
| perl -0pi -e 's/(\[workspace\.package\][\s\S]*?\nversion = ")[^"]+(")/$1$ENV{NEXT_VERSION}$2/' Cargo.toml | ||
| # `--workspace` re-resolves the local packages only, which is what a | ||
| # version bump changes. `-p <name> --precise` cannot express "and the | ||
| # other member moved too". | ||
| cargo update --workspace | ||
| released="$(cargo metadata --format-version 1 --no-deps \ | ||
| | jq -r --arg name "$CRATE_NAME" \ | ||
| '.packages[] | select(.name == $name) | .version')" | ||
| if [[ "$released" != "$NEXT_VERSION" ]]; then | ||
| echo "version bump did not take: expected ${NEXT_VERSION}, got ${released}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Commit version bump and tag | ||
| if: ${{ inputs.bump != 'current' }} | ||
|
|
@@ -203,7 +225,7 @@ jobs: | |
| with: | ||
| ref: ${{ needs.prepare.outputs.tag }} | ||
| persist-credentials: false | ||
| submodules: true | ||
| submodules: recursive | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
|
|
||
|
|
@@ -222,7 +244,7 @@ jobs: | |
| fi | ||
|
|
||
| - name: Build installable module | ||
| run: cargo build --locked --release --lib | ||
| run: cargo build --locked --release --lib --package ${{ env.RELEASE_PACKAGE }} | ||
|
|
||
| - name: Verify Unix module through TinyBus loader | ||
| if: ${{ runner.os != 'Windows' }} | ||
|
|
@@ -237,7 +259,7 @@ jobs: | |
| macOS) module="target/release/lib${library_name}.dylib" ;; | ||
| *) echo "unsupported Unix runner: ${RUNNER_OS}" >&2; exit 1 ;; | ||
| esac | ||
| cargo run --locked --example verify_module -- "$module" | ||
| cargo run --locked --package template --example verify_module -- "$module" | ||
|
|
||
| - name: Verify Windows module through TinyBus loader | ||
| if: ${{ runner.os == 'Windows' }} | ||
|
|
@@ -248,7 +270,7 @@ jobs: | |
| $ErrorActionPreference = 'Stop' | ||
| $libraryName = $env:CRATE_NAME.Replace('-', '_') | ||
| $module = "target/release/$libraryName.dll" | ||
| $verifyRoot = Join-Path $env:RUNNER_TEMP 'rust-template-module-verify' | ||
| $verifyRoot = Join-Path $env:RUNNER_TEMP 'template-module-verify' | ||
| New-Item -ItemType Directory -Force $verifyRoot | Out-Null | ||
|
|
||
| $identity = [System.Security.Principal.WindowsIdentity]::GetCurrent() | ||
|
|
@@ -278,7 +300,7 @@ jobs: | |
|
|
||
| $verifiedModule = Join-Path $verifyRoot "$libraryName.dll" | ||
| Copy-Item -LiteralPath $module -Destination $verifiedModule | ||
| cargo run --locked --example verify_module -- $verifiedModule | ||
| cargo run --locked --package template --example verify_module -- $verifiedModule | ||
|
|
||
| - name: Assemble Unix module package | ||
| if: ${{ runner.os != 'Windows' }} | ||
|
|
@@ -353,15 +375,15 @@ jobs: | |
|
|
||
| - name: Upload Unix package | ||
| if: ${{ runner.os != 'Windows' }} | ||
| uses: actions/upload-artifact@v4 | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: ${{ needs.prepare.outputs.crate_name }}-${{ matrix.id }} | ||
| path: ${{ steps.unix_package.outputs.archive }} | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload Windows package | ||
| if: ${{ runner.os == 'Windows' }} | ||
| uses: actions/upload-artifact@v4 | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: ${{ needs.prepare.outputs.crate_name }}-${{ matrix.id }} | ||
| path: ${{ steps.windows_package.outputs.archive }} | ||
|
|
@@ -414,7 +436,7 @@ jobs: | |
| with: | ||
| ref: ${{ needs.prepare.outputs.tag }} | ||
| persist-credentials: false | ||
| submodules: true | ||
| submodules: recursive | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
|
|
||
|
|
@@ -430,7 +452,7 @@ jobs: | |
| fi | ||
|
|
||
| - name: Build installable module | ||
| run: cargo build --locked --release --lib | ||
| run: cargo build --locked --release --lib --package ${{ env.RELEASE_PACKAGE }} | ||
|
|
||
| - name: Verify module through TinyBus loader | ||
| env: | ||
|
|
@@ -441,7 +463,7 @@ jobs: | |
| verify_root="/opt/${CRATE_NAME}-module-verify" | ||
| install -d -m 700 "$verify_root" | ||
| install -m 755 "target/release/lib${library_name}.so" "$verify_root/" | ||
| cargo run --locked --example verify_module -- \ | ||
| cargo run --locked --package template --example verify_module -- \ | ||
| "$verify_root/lib${library_name}.so" | ||
|
|
||
| - name: Assemble distribution module package | ||
|
|
@@ -475,7 +497,7 @@ jobs: | |
| echo "archive=dist/${package_name}.tar.gz" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Upload distribution package | ||
| uses: actions/upload-artifact@v4 | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: ${{ needs.prepare.outputs.crate_name }}-${{ matrix.id }} | ||
| path: ${{ steps.package.outputs.archive }} | ||
|
|
@@ -493,13 +515,13 @@ jobs: | |
| with: | ||
| ref: ${{ needs.prepare.outputs.tag }} | ||
| persist-credentials: false | ||
| submodules: true | ||
| submodules: recursive | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - uses: actions/download-artifact@v4 | ||
| - uses: actions/download-artifact@v8 | ||
| with: | ||
| pattern: '*' | ||
| path: release-assets | ||
|
|
@@ -565,5 +587,5 @@ jobs: | |
| cargo run --manifest-path vendor/tinybus/Cargo.toml --locked \ | ||
| --package tinybus --all-features --example github_module_host -- \ | ||
| "$release_url" "$archive" "$sha256" | ||
| cargo run --locked --example verify_github_release -- \ | ||
| cargo run --locked --package template --example verify_github_release -- \ | ||
| "$release_url" "$archive" "$sha256" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
taiki-e/install-actionis pinned tov2, which is mutableA tag or branch can be repointed by whoever owns
taiki-e, and the new code runs with this workflow's secrets. Pin to a full commit SHA and let Dependabot bump it.[RULE] unpinned-action ·