-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2ef720
commit b97eab0
Showing
3 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Publish Dry Run | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
crates: | ||
description: 'Space separated list of crate names in the order to be published.' | ||
required: true | ||
type: string | ||
runs-on: | ||
required: false | ||
default: 'ubuntu-latest' | ||
type: string | ||
target: | ||
required: false | ||
default: 'x86_64-unknown-linux-gnu' | ||
type: string | ||
cargo-hack-feature-options: | ||
required: false | ||
default: '--feature-powerset' | ||
type: string | ||
|
||
jobs: | ||
|
||
publish-dry-run: | ||
runs-on: ${{ inputs.runs-on }} | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
CARGO_BUILD_TARGET: ${{ inputs.target }} | ||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: stellar/actions/rust-cache@main | ||
|
||
- run: rustup update | ||
- run: rustup target add ${{ inputs.target }} | ||
- if: inputs.target == 'aarch64-unknown-linux-gnu' | ||
run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
|
||
- uses: stellar/binaries@v18 | ||
with: | ||
name: cargo-hack | ||
version: 0.5.28 | ||
|
||
# Vendor all the dependencies into the vendor/ folder. Temporarily remove | ||
# [patch.crates-io] entries in the workspace Cargo.toml that reference git | ||
# repos. These will be removed when published. | ||
- name: Vendor Dependencies | ||
run: | | ||
cargo vendor --versioned-dirs | ||
# Package the crates that will be published. Verification is disabled | ||
# because we aren't ready to verify yet. Add each crate that was packaged to | ||
# the vendor/ directory. | ||
- name: Package Crates ${{ inputs.crates }} | ||
run: | | ||
for name in ${{ inputs.crates }} | ||
do | ||
version=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="'$name'") | .version') | ||
cargo package \ | ||
--no-verify \ | ||
--package $name \ | ||
--config "source.crates-io.replace-with = 'vendored-sources'" \ | ||
--config "source.vendored-sources.directory = 'vendor'" | ||
path="target/package/${name}-${version}.crate" | ||
tar xvfz "$path" -C vendor/ | ||
# Crates in the vendor directory require a checksum file, but it doesn't | ||
# matter if it is empty. | ||
echo '{"files":{}}' > vendor/$name-$version/.cargo-checksum.json | ||
done | ||
# Rerun the package command but with verification enabled this time. Tell | ||
# cargo to use the local vendor/ directory as the source for all packages. Run | ||
# the package command on the full feature powerset so that all features of | ||
# each crate are verified to compile. | ||
- name: Verify Crates with ${{ inputs.cargo-hack-feature-options }} | ||
run: > | ||
cargo-hack hack | ||
${{ inputs.cargo-hack-feature-options }} | ||
--ignore-private | ||
--config "source.crates-io.replace-with = 'vendored-sources'" | ||
--config "source.vendored-sources.directory = 'vendor'" | ||
package | ||
--target ${{ inputs.target }} |
This file contains 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 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