name: CI on: workflow_dispatch: pull_request: push: branches: - main jobs: test: name: Test (+${{ matrix.rust }}) on ${{ matrix.os }} # The large timeout is to accommodate Windows builds timeout-minutes: 75 runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] rust: [stable] env: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full steps: - uses: actions/checkout@v2.4.0 with: persist-credentials: false - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} profile: minimal override: true - uses: Swatinem/rust-cache@v1 - name: cargo fetch uses: actions-rs/cargo@v1.0.3 with: command: fetch - name: Install LLVM on Windows if: matrix.os == 'windows-latest' run: | choco install llvm -y 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 - name: Skip network tests on Ubuntu # Ubuntu runners don't have network or DNS configured during test steps if: matrix.os == 'ubuntu-latest' run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" >> $GITHUB_ENV - name: Skip network tests on Windows # Windows runners have an unreliable network if: matrix.os == 'windows-latest' run: echo "ZEBRA_SKIP_NETWORK_TESTS=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Show env vars run: | echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" - name: Change target output directory on Windows # Windows doesn't have enough space on the D: drive, so we redirect the build output to the # larger C: drive. # TODO: Remove this workaround once the build is more efficient (#3005). if: matrix.os == 'windows-latest' run: | mkdir C:\zebra-target echo "CARGO_TARGET_DIR=C:\zebra-target" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Run tests uses: actions-rs/cargo@v1.0.3 with: command: test args: --verbose --all - name: Run tests with fake activation heights uses: actions-rs/cargo@v1.0.3 env: TEST_FAKE_ACTIVATION_HEIGHTS: with: command: test # Note: this only runs the zebra-state crate tests, because re-running all the test binaries is slow on Windows args: --verbose --package zebra-state --lib -- with_fake_activation_heights # Explicitly run any tests that are usually #[ignored] - 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 if: matrix.os == 'macOS-latest' uses: actions-rs/cargo@v1.0.3 with: command: test # Note: this only runs the zebrad acceptance tests, because re-running all the test binaries is slow on Windows args: --verbose --package zebrad --test acceptance sync_large_checkpoints_ -- --ignored build-chain-no-features: name: Build (+${{ matrix.rust }}) zebra-chain w/o features on ubuntu-latest timeout-minutes: 60 runs-on: ubuntu-latest strategy: matrix: rust: [stable, beta] env: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full steps: - uses: actions/checkout@v2.4.0 with: persist-credentials: false - uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} profile: minimal override: true - uses: Swatinem/rust-cache@v1 - name: cargo fetch uses: actions-rs/cargo@v1.0.3 with: command: fetch - name: Show env vars run: | echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" - name: Run build without features enabled working-directory: ./zebra-chain run: cargo build --verbose --no-default-features build: name: Build (+stable) on ubuntu-latest timeout-minutes: 60 runs-on: ubuntu-latest env: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full steps: - uses: actions/checkout@v2.4.0 with: persist-credentials: false - uses: actions-rs/toolchain@v1 with: toolchain: stable profile: minimal override: true - uses: Swatinem/rust-cache@v1 - name: cargo fetch uses: actions-rs/cargo@v1.0.3 with: command: fetch - name: Show env vars run: | echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" - name: Build uses: actions-rs/cargo@v1.0.3 with: command: build args: --verbose --release clippy-cargo-lock: name: Clippy (stable) timeout-minutes: 30 runs-on: ubuntu-latest env: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full steps: - uses: actions/checkout@v2.4.0 with: persist-credentials: false - uses: actions-rs/toolchain@v1 with: toolchain: stable components: clippy override: true - uses: Swatinem/rust-cache@v1 - name: Show env vars run: | echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" - name: Run clippy uses: actions-rs/clippy-check@v1.0.7 with: # GitHub displays the clippy job and its results as separate entries name: Clippy (stable) Results token: ${{ secrets.GITHUB_TOKEN }} args: --all-features --all-targets -- -D warnings # This check makes sure the crate dependency check is accurate - name: Check Cargo.lock is up to date uses: actions-rs/cargo@v1.0.3 with: command: check args: --locked --all-features --all-targets fmt-deps: name: Rustfmt timeout-minutes: 30 runs-on: ubuntu-latest env: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full steps: - uses: actions/checkout@v2.4.0 with: persist-credentials: false - uses: actions-rs/toolchain@v1 with: toolchain: stable components: rustfmt override: true - uses: Swatinem/rust-cache@v1 - name: Show env vars run: | echo "ZEBRA_SKIP_NETWORK_TESTS=${{ env.ZEBRA_SKIP_NETWORK_TESTS }}" echo "CARGO_INCREMENTAL=${{ env.CARGO_INCREMENTAL }}" echo "RUST_BACKTRACE=${{ env.RUST_BACKTRACE }}" - name: Check rustfmt uses: actions-rs/cargo@v1.0.3 with: command: fmt args: --all -- --check # Edit zebra/deny.toml to allow duplicates - name: Check for dependent crates with different versions uses: EmbarkStudios/cargo-deny-action@v1.2.6 with: command: check bans args: --all-features --workspace - name: Check crate sources uses: EmbarkStudios/cargo-deny-action@v1.2.6 with: command: check sources args: --all-features --workspace