Use Swatinem/rust-cache@v1 (#2291)

This commit is contained in:
Deirdre Connolly 2021-06-14 21:36:33 -04:00 committed by GitHub
parent 28c3a23f14
commit ea15ad1131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 1 deletions

View File

@ -27,40 +27,50 @@ jobs:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
with: with:
persist-credentials: false persist-credentials: false
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
profile: minimal profile: minimal
override: true override: true
- uses: Swatinem/rust-cache@v1
- name: cargo fetch - name: cargo fetch
uses: actions-rs/cargo@v1.0.3 uses: actions-rs/cargo@v1.0.3
with: with:
command: fetch command: fetch
- name: Install LLVM on Windows - name: Install LLVM on Windows
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: | run: |
choco install llvm -y choco install llvm -y
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Skip network tests on Ubuntu - name: Skip network tests on Ubuntu
# Ubuntu runners don't have network or DNS configured during test steps # Ubuntu runners don't have network or DNS configured during test steps
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" >> $GITHUB_ENV run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" >> $GITHUB_ENV
- name: Skip network tests on Windows - name: Skip network tests on Windows
# Windows runners have an unreliable network # Windows runners have an unreliable network
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Show env vars - name: Show env vars
run: | run: |
echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}"
echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}"
echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}"
- name: Run tests - name: Run tests
uses: actions-rs/cargo@v1.0.3 uses: actions-rs/cargo@v1.0.3
with: with:
command: test command: test
args: --verbose --all args: --verbose --all
# Explicitly run any tests that are usually #[ignored] # Explicitly run any tests that are usually #[ignored]
- name: Run zebrad large sync tests - name: Run zebrad large sync tests
# Skip the entire step on Ubuntu and Windows, because the test would be skipped anyway due to ZEBRA_SKIP_NETWORK_TESTS # Skip the entire step on Ubuntu and Windows, because the test would be skipped anyway due to ZEBRA_SKIP_NETWORK_TESTS
if: matrix.os == 'macOS-latest' if: matrix.os == 'macOS-latest'
@ -85,20 +95,26 @@ jobs:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
with: with:
persist-credentials: false persist-credentials: false
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
profile: minimal profile: minimal
override: true override: true
- uses: Swatinem/rust-cache@v1
- name: cargo fetch - name: cargo fetch
uses: actions-rs/cargo@v1.0.3 uses: actions-rs/cargo@v1.0.3
with: with:
command: fetch command: fetch
- name: Show env vars - name: Show env vars
run: | run: |
echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}"
echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}"
echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}"
- name: Run build without features enabled - name: Run build without features enabled
working-directory: ./zebra-chain working-directory: ./zebra-chain
run: cargo build --verbose --no-default-features run: cargo build --verbose --no-default-features
@ -116,20 +132,26 @@ jobs:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
with: with:
persist-credentials: false persist-credentials: false
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
profile: minimal profile: minimal
override: true override: true
- uses: Swatinem/rust-cache@v1
- name: cargo fetch - name: cargo fetch
uses: actions-rs/cargo@v1.0.3 uses: actions-rs/cargo@v1.0.3
with: with:
command: fetch command: fetch
- name: Show env vars - name: Show env vars
run: | run: |
echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}"
echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}"
echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}"
- name: Build - name: Build
uses: actions-rs/cargo@v1.0.3 uses: actions-rs/cargo@v1.0.3
with: with:
@ -148,16 +170,21 @@ jobs:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
with: with:
persist-credentials: false persist-credentials: false
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
components: clippy components: clippy
override: true override: true
- uses: Swatinem/rust-cache@v1
- name: Show env vars - name: Show env vars
run: | run: |
echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}"
echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}"
echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}"
- name: Run clippy - name: Run clippy
uses: actions-rs/clippy-check@v1.0.7 uses: actions-rs/clippy-check@v1.0.7
with: with:
@ -178,17 +205,21 @@ jobs:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
with: with:
persist-credentials: false persist-credentials: false
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
components: rustfmt components: rustfmt
override: true override: true
- run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v1
- name: Show env vars - name: Show env vars
run: | run: |
echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}"
echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}"
echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}"
- uses: actions-rs/cargo@v1.0.3 - uses: actions-rs/cargo@v1.0.3
with: with:
command: fmt command: fmt

View File

@ -1,6 +1,7 @@
name: CI name: CI
on: on:
workflow_dispatch:
pull_request: pull_request:
branches: branches:
- main - main
@ -27,6 +28,8 @@ jobs:
profile: minimal profile: minimal
components: llvm-tools-preview components: llvm-tools-preview
- uses: Swatinem/rust-cache@v1
- name: Install rustfilt symbol demangler - name: Install rustfilt symbol demangler
run: | run: |
cargo install rustfilt cargo install rustfilt

View File

@ -25,6 +25,8 @@ jobs:
components: rust-docs components: rust-docs
override: true override: true
- uses: Swatinem/rust-cache@v1
- name: Install mdbook - name: Install mdbook
run: | run: |
cargo install mdbook cargo install mdbook