refactor(ci): migrate from abandoned `actions-rs/*` (#6628)

* refactor(ci): migrate from abandoned `actions-rs/*`

* ci(lint): keep clippy action until we find a better candidate
This commit is contained in:
Gustavo Valverde 2023-05-10 10:25:41 -04:00 committed by GitHub
parent d07dc7f9f1
commit 25ca4cc520
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 80 additions and 117 deletions

View File

@ -25,13 +25,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v3.5.2 - uses: actions/checkout@v3.5.2
- uses: actions-rs/toolchain@v1 # Setup Rust with stable toolchain and minimal profile
with: - name: Setup Rust
toolchain: stable run: |
profile: minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
override: true
- uses: actions-rs/cargo@v1.0.3
# This step is meant to dynamically create a JSON containing the values of each crate # This step is meant to dynamically create a JSON containing the values of each crate
# available in this repo in the root directory. We use `cargo tree` to accomplish this task. # available in this repo in the root directory. We use `cargo tree` to accomplish this task.
# #

View File

@ -52,13 +52,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v3.5.2 - uses: actions/checkout@v3.5.2
- uses: actions-rs/toolchain@v1 # Setup Rust with stable toolchain and minimal profile
with: - name: Setup Rust
toolchain: stable run: |
profile: minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
override: true
- uses: actions-rs/cargo@v1.0.3
# This step is meant to dynamically create a JSON containing the values of each crate # This step is meant to dynamically create a JSON containing the values of each crate
# available in this repo in the root directory. We use `cargo tree` to accomplish this task. # available in this repo in the root directory. We use `cargo tree` to accomplish this task.
# #
@ -117,30 +115,23 @@ jobs:
version: '3.20.1' version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1 # Setup Rust with stable toolchain and minimal profile
with: - name: Setup Rust
toolchain: stable run: |
profile: minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
override: true
# We could use `features: ['', '--all-features', '--no-default-features']` as a matrix argument, # We could use `features: ['', '--all-features', '--no-default-features']` as a matrix argument,
# but it's faster to run these commands sequentially, so they can re-use the local cargo cache. # but it's faster to run these commands sequentially, so they can re-use the local cargo cache.
# #
# Some Zebra crates do not have any features, and most don't have any default features. # Some Zebra crates do not have any features, and most don't have any default features.
- name: Build ${{ matrix.crate }} crate with no default features - name: Build ${{ matrix.crate }} crate with no default features
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo build --package ${{ matrix.crate }} --no-default-features
command: build
args: --package ${{ matrix.crate }} --no-default-features
- name: Build ${{ matrix.crate }} crate normally - name: Build ${{ matrix.crate }} crate normally
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo build --package ${{ matrix.crate }}
command: build
args: --package ${{ matrix.crate }}
- name: Build ${{ matrix.crate }} crate with all features - name: Build ${{ matrix.crate }} crate with all features
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo build --package ${{ matrix.crate }} --all-features
command: build
args: --package ${{ matrix.crate }} --all-features

View File

@ -94,13 +94,13 @@ jobs:
version: '3.20.1' version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1 # Setup Rust with ${{ matrix.rust }} toolchain and minimal profile
with: - name: Setup Rust
toolchain: ${{ matrix.rust }} run: |
profile: minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=${{ matrix.rust }} --profile=minimal
override: true
- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2.2.1
# TODO: change Rust cache target directory on Windows, # TODO: change Rust cache target directory on Windows,
# or remove this workaround once the build is more efficient (#3005). # or remove this workaround once the build is more efficient (#3005).
#with: #with:
@ -120,9 +120,8 @@ jobs:
echo "CARGO_TARGET_DIR=C:\\zebra-target" | Out-File -FilePath "$env:GITHUB_ENV" -Encoding utf8 -Append echo "CARGO_TARGET_DIR=C:\\zebra-target" | Out-File -FilePath "$env:GITHUB_ENV" -Encoding utf8 -Append
- name: cargo fetch - name: cargo fetch
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo fetch
command: fetch
- name: Install LLVM on Windows - name: Install LLVM on Windows
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
@ -177,10 +176,8 @@ jobs:
# #
# If some tests hang, add "-- --nocapture" for just that test, or for all the tests. # If some tests hang, add "-- --nocapture" for just that test, or for all the tests.
- name: Run tests${{ matrix.features }} - name: Run tests${{ matrix.features }}
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo test ${{ matrix.features }} --release --verbose --workspace
command: test
args: ${{ matrix.features }} --release --verbose --workspace
# Explicitly run any tests that are usually #[ignored] # Explicitly run any tests that are usually #[ignored]
@ -189,11 +186,8 @@ jobs:
# Currently, this also skips large sync with `getblocktemplate-rpcs`, # Currently, this also skips large sync with `getblocktemplate-rpcs`,
# but that is already covered by the Docker tests. # but that is already covered by the Docker tests.
if: matrix.os == 'macos-latest' if: matrix.os == 'macos-latest'
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo test ${{ matrix.features }} --release --verbose --package zebrad --test acceptance -- --nocapture --include-ignored sync_large_checkpoints_
command: test
# Note: this only runs the zebrad acceptance tests, because re-running all the test binaries is slow on Windows
args: ${{ matrix.features }} --release --verbose --package zebrad --test acceptance -- --nocapture --include-ignored sync_large_checkpoints_
# Install Zebra with lockfile dependencies, with no caching and default features # Install Zebra with lockfile dependencies, with no caching and default features
install-from-lockfile-no-cache: install-from-lockfile-no-cache:
@ -206,17 +200,14 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
- uses: actions-rs/toolchain@v1 # Setup Rust with stable toolchain and minimal profile
with: - name: Setup Rust
toolchain: stable run: |
profile: minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
override: true
- name: Install - name: Install zebrad
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo install --locked --path ./zebrad/ zebrad
command: install
args: --locked --path ./zebrad/ zebrad
# Check that Cargo.lock includes any Cargo.toml changes. # Check that Cargo.lock includes any Cargo.toml changes.
# This check makes sure the `cargo-deny` crate dependency checks are accurate. # This check makes sure the `cargo-deny` crate dependency checks are accurate.
@ -237,22 +228,18 @@ jobs:
version: '3.20.1' version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1 # Setup Rust with stable toolchain and minimal profile
with: - name: Setup Rust
toolchain: stable run: |
profile: minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
override: true
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v2.2.1
with: with:
# TODO: change to shared-key when we switch to Swatinem/rust-cache@v2 shared-key: "clippy-cargo-lock"
sharedKey: "clippy-cargo-lock"
- name: Check Cargo.lock is up to date - name: Check Cargo.lock is up to date
uses: actions-rs/cargo@v1.0.3 run: |
with: cargo check --locked --all-features --all-targets
command: check
args: --locked --all-features --all-targets
cargo-deny: cargo-deny:
name: Check deny.toml ${{ matrix.checks }} ${{ matrix.features }} name: Check deny.toml ${{ matrix.checks }} ${{ matrix.features }}
@ -290,12 +277,10 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
- name: Install toolchain # Setup Rust with stable toolchain and minimal profile
uses: actions-rs/toolchain@v1 - name: Setup Rust
with: run: |
toolchain: stable curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal
profile: minimal
override: true
- name: Install cargo-machete - name: Install cargo-machete
uses: baptiste0928/cargo-install@v2.0.0 uses: baptiste0928/cargo-install@v2.0.0

View File

@ -61,12 +61,10 @@ jobs:
with: with:
persist-credentials: false persist-credentials: false
- uses: actions-rs/toolchain@v1.0.7 # Setup Rust with stable toolchain and minimal profile
with: - name: Setup Rust
toolchain: stable run: |
override: true curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=minimal --component=llvm-tools-preview
profile: minimal
components: llvm-tools-preview
- name: Install cargo-llvm-cov cargo command - name: Install cargo-llvm-cov cargo command
run: cargo install cargo-llvm-cov run: cargo install cargo-llvm-cov

View File

@ -51,14 +51,12 @@ jobs:
version: '3.20.1' version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install latest beta # Setup Rust with beta toolchain and default profile (to include rust-docs)
uses: actions-rs/toolchain@v1 - name: Setup Rust
with: run: |
toolchain: beta curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=beta --profile=default
components: rust-docs
override: true
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v2.2.1
- name: Setup mdBook - name: Setup mdBook
uses: peaceiris/actions-mdbook@v1.2.0 uses: peaceiris/actions-mdbook@v1.2.0

View File

@ -81,11 +81,16 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v1 # Setup Rust with stable toolchain and default profile
with: - name: Setup Rust
# TODO: change to shared-key when we switch to Swatinem/rust-cache@v2 run: |
sharedKey: "clippy-cargo-lock" curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=default
- uses: Swatinem/rust-cache@v2.2.1
with:
shared-key: "clippy-cargo-lock"
# TODO: keep this action until we find a better solution
- name: Run clippy action to produce annotations - name: Run clippy action to produce annotations
uses: actions-rs/clippy-check@v1.0.7 uses: actions-rs/clippy-check@v1.0.7
if: ${{ steps.check_permissions.outputs.has-permission }} if: ${{ steps.check_permissions.outputs.has-permission }}
@ -95,12 +100,6 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings args: --all-features --all-targets -- -D warnings
- uses: actions-rs/toolchain@v1.0.1
if: ${{ !steps.check_permissions.outputs.has-permission }}
with:
toolchain: stable
override: true
- name: Run clippy manually without annotations - name: Run clippy manually without annotations
if: ${{ !steps.check_permissions.outputs.has-permission }} if: ${{ !steps.check_permissions.outputs.has-permission }}
run: cargo clippy --all-features --all-targets -- -D warnings run: cargo clippy --all-features --all-targets -- -D warnings
@ -124,20 +123,17 @@ jobs:
version: '3.20.1' version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1.0.6 # Setup Rust with stable toolchain and default profile
with: - name: Setup Rust
toolchain: stable run: |
components: rustfmt curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=default
override: true
# We don't cache `fmt` outputs because the job is quick, # We don't cache `fmt` outputs because the job is quick,
# and we want to use the limited GitHub actions cache space for slower jobs. # and we want to use the limited GitHub actions cache space for slower jobs.
#- uses: Swatinem/rust-cache@v1 #- uses: Swatinem/rust-cache@v2.2.1
- uses: actions-rs/cargo@v1.0.3 - run: |
with: cargo fmt --all -- --check
command: fmt
args: --all -- --check
docs: docs:
name: Rust doc name: Rust doc
@ -165,16 +161,13 @@ jobs:
version: '3.20.1' version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1.0.6 # Setup Rust with stable toolchain and default profile
with: - name: Setup Rust
toolchain: stable run: |
profile: minimal curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=stable --profile=default
override: true
- uses: actions-rs/cargo@v1.0.3 - run: |
with: cargo doc --no-deps --document-private-items --all-features
command: doc
args: --no-deps --document-private-items --all-features
actionlint: actionlint:
runs-on: ubuntu-latest runs-on: ubuntu-latest