nomos-node/.github/workflows/build-test.yml

104 lines
2.8 KiB
YAML

# copy of https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
# Steps for checking PRs.
on:
pull_request:
branches:
- "*"
push:
branches: [master]
name: PR check
jobs:
check:
name: Check
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
feature: [libp2p]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all --no-default-features --features ${{ matrix.feature }}
test:
name: Test Suite
if: ${{ !startsWith(github.event.pull_request.title, '[WIP]') && !contains(github.event.label.name, 'DO NOT MERGE') }}
strategy:
fail-fast: false # all OSes should be tested even if one fails (default: true)
matrix:
feature: [libp2p]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
# Setup Rust toolchain with GNU for Windows
- name: Setup Rust with GNU toolchain (Windows)
if: matrix.os == 'windows-latest'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-gnu
target: x86_64-pc-windows-gnu
override: true
# Setup Rust toolchain for other OSes
- name: Setup Rust toolchain (Other OSes)
if: matrix.os != 'windows-latest'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# Setup build environment (Windows)
- name: Setup build environment (Windows)
if: matrix.os == 'windows-latest'
uses: ./.github/actions/mingw-env
- uses: actions-rs/cargo@v1
with:
command: build
args: --all --no-default-features --features ${{ matrix.feature }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --all --no-default-features --features ${{ matrix.feature }}
lints:
name: Rust lints
runs-on: ubuntu-latest
strategy:
matrix:
feature: [libp2p]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --no-default-features --features ${{ matrix.feature }} -- --deny warnings