-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from alloy-rs/zerosnacks/add-github-workflows
Add Github CI workflow
- Loading branch information
Showing
15 changed files
with
243 additions
and
15 deletions.
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,61 @@ | ||
# Runs weeky `cargo update` to keep dependencies current. | ||
|
||
name: Update dependencies | ||
|
||
on: | ||
schedule: | ||
# Run weekly | ||
- cron: "0 0 * * SUN" | ||
workflow_dispatch: | ||
# Needed so we can run it manually | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: cargo-update | ||
TITLE: "chore(deps): weekly `cargo update`" | ||
BODY: | | ||
Automation to keep dependencies in `Cargo.lock` current. | ||
<details><summary><strong>cargo update log</strong></summary> | ||
<p> | ||
```log | ||
$cargo_update_log | ||
``` | ||
</p> | ||
</details> | ||
jobs: | ||
update: | ||
name: Update | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@nightly | ||
|
||
- name: cargo update | ||
# Remove first line that always just says "Updating crates.io index" | ||
run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log | ||
|
||
- name: craft commit message and PR body | ||
id: msg | ||
run: | | ||
export cargo_update_log="$(cat cargo_update.log)" | ||
echo "commit_message<<EOF" >> $GITHUB_OUTPUT | ||
printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
echo "body<<EOF" >> $GITHUB_OUTPUT | ||
echo "$BODY" | envsubst >> $GITHUB_OUTPUT | ||
echo "EOF" >> $GITHUB_OUTPUT | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
add-paths: ./Cargo.lock | ||
commit-message: ${{ steps.msg.outputs.commit_message }} | ||
title: ${{ env.TITLE }} | ||
body: ${{ steps.msg.outputs.body }} | ||
branch: ${{ env.BRANCH }} |
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,74 @@ | ||
# Runs Alloy integration tests daily to ensure compatibility with the latest version of Alloy. | ||
|
||
name: Alloy integration test | ||
|
||
on: | ||
schedule: | ||
# Run daily | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
# Needed so we can run it manually | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: foundry-rs/foundry-toolchain@v1 | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: Run examples | ||
run: | | ||
# Get the list of runable examples | ||
export examples="$( | ||
cargo run --example 2>&1 \ | ||
| grep -E '^ ' \ | ||
| grep -v \ | ||
-e 'trezor_signer' \ | ||
-e 'ledger_signer' \ | ||
-e 'yubi_signer' \ | ||
-e 'ipc' \ | ||
-e 'ws' \ | ||
-e 'ws_auth' \ | ||
| xargs -n1 echo | ||
)" | ||
# Run the examples with the current version of Alloy | ||
for example in $examples; do | ||
cargo run --example $example --quiet 1>/dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to run: $example" | ||
exit 1 | ||
else | ||
echo "Successfully ran: $example" | ||
fi | ||
done | ||
# Fetch the latest commit hash of the main branch from the Alloy repository | ||
export latest_alloy_commit=$(git ls-remote https://github.com/alloy-rs/alloy.git \ | ||
| grep refs/heads/main \ | ||
| cut -f 1) | ||
# Use the commit hash to update the rev in Cargo.toml | ||
sed -i 's/\(alloy = { git = "https:\/\/github.com\/alloy-rs\/alloy", rev = "\)[^"]*/\1'"$latest_alloy_commit"'/' \ | ||
Cargo.toml | ||
# Update to the latest commit | ||
cargo update | ||
# Run the examples with the latest version of Alloy | ||
for example in $examples; do | ||
cargo run --example $example --quiet 1>/dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to run: $example" | ||
exit 1 | ||
else | ||
echo "Successfully ran: $example" | ||
fi | ||
done | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Runs build checks and examples. | ||
|
||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: taiki-e/install-action@cargo-hack | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: cargo hack | ||
run: cargo hack check --feature-powerset --depth 2 | ||
|
||
examples: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: foundry-rs/foundry-toolchain@v1 | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: Run examples | ||
run: | | ||
# Get the list of runable examples | ||
export examples="$( | ||
cargo run --example 2>&1 \ | ||
| grep -E '^ ' \ | ||
| grep -v \ | ||
-e 'trezor_signer' \ | ||
-e 'ledger_signer' \ | ||
-e 'yubi_signer' \ | ||
-e 'ipc' \ | ||
-e 'ws' \ | ||
-e 'ws_auth' \ | ||
| xargs -n1 echo | ||
)" | ||
# Run the examples | ||
for example in $examples; do | ||
cargo run --example $example --quiet 1>/dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to run: $example" | ||
exit 1 | ||
else | ||
echo "Successfully ran: $example" | ||
fi | ||
done |
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
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
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
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
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
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