zebra/.github/workflows/ci.yml

196 lines
5.7 KiB
YAML
Raw Normal View History

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
ci-success:
name: 🏁
runs-on: ubuntu-latest
needs:
- test
- build
- build-chain-no-features
- clippy
- fmt
steps:
- run: exit 0
test:
name: Test (+${{ matrix.rust }}) on ${{ matrix.os }}
# The large timeout is to accommodate Windows builds
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
2021-02-18 15:54:35 -08:00
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
2021-02-11 07:06:54 -08:00
rust: [stable, beta]
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
2021-02-11 07:06:54 -08:00
toolchain: ${{ matrix.rust }}
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: Install LLVM on Windows
if: matrix.os == 'windows-latest'
run: choco install llvm -y
- 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: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --all
# 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
with:
command: test
2020-10-30 13:06:48 -07:00
args: --verbose --manifest-path zebrad/Cargo.toml sync_large_checkpoints_ -- --ignored
build-chain-no-features:
2021-02-11 08:44:06 -08:00
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@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
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 (+${{ matrix.rust }}) on ${{ matrix.os }}
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
2021-02-11 07:06:54 -08:00
rust: [stable, beta]
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
2021-02-11 06:45:57 -08:00
toolchain: ${{ matrix.rust }}
override: true
- name: Install LLVM on Windows
if: matrix.os == 'windows-latest'
run: choco install llvm -y
- name: cargo fetch
uses: actions-rs/cargo@v1
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
with:
command: build
args: --verbose --release
2020-01-23 13:40:32 -08:00
clippy:
name: Clippy (stable)
2020-10-12 15:19:55 -07:00
timeout-minutes: 30
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
2020-01-24 12:09:01 -08:00
with:
toolchain: stable
components: clippy
override: true
- 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 }}"
2020-02-04 21:34:38 -08:00
- name: Run clippy
uses: actions-rs/clippy-check@v1
2020-02-04 21:34:38 -08:00
with:
name: Clippy (stable)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
fmt:
name: Rustfmt
2020-10-12 15:19:55 -07:00
timeout-minutes: 30
runs-on: ubuntu-latest
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: rustup component add rustfmt
- 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 }}"
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check