From 3be0d1a8a04698ddec35249bd28610100c273fcc Mon Sep 17 00:00:00 2001 From: gusto Date: Fri, 1 Sep 2023 10:45:53 +0300 Subject: [PATCH] Update GH actions for master and prs (#365) --- .github/workflows/master.yml | 18 ++++--- .github/workflows/pr.yml | 94 ++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index c581737c..a883c1e3 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -11,6 +11,10 @@ jobs: check: name: Check runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + feature: [libp2p, waku] steps: - uses: actions/checkout@v2 with: @@ -24,13 +28,13 @@ jobs: continue-on-error: true with: command: check + args: --all --no-default-features --features ${{ matrix.feature }} - test: - name: Test Suite strategy: fail-fast: false # all OSes should be tested even if one fails (default: true) matrix: - os: [ubuntu-latest, windows-latest] # macos-latest removed because 1 min on macos is x10 on GH runtime. + feature: [libp2p, waku] + os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -48,16 +52,18 @@ jobs: continue-on-error: true with: command: build - args: --all-features + args: --all --no-default-features --features ${{ matrix.feature }} - uses: actions-rs/cargo@v1 continue-on-error: true with: command: test - args: --all-features + args: --all --no-default-features --features ${{ matrix.feature }} lints: name: Rust lints runs-on: ubuntu-latest + matrix: + feature: [libp2p, waku] steps: - uses: actions/checkout@v2 with: @@ -81,4 +87,4 @@ jobs: continue-on-error: true with: command: clippy - args: -- --deny warnings + args: --all --no-default-features --features ${{ matrix.feature }} -- --deny warnings diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..1fc583c1 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,94 @@ +# copy of https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md +# Steps for checking PRs. +on: + pull_request: + branches: + - "*" + +name: PR check + +jobs: + check: + name: Check + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + feature: [libp2p, waku] + 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 + continue-on-error: true + 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, waku] + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: actions/setup-go@v3 # we need go to build go-waku + with: + go-version: '1.19' + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + continue-on-error: true + with: + command: build + args: --all --no-default-features --features ${{ matrix.feature }} + - uses: actions-rs/cargo@v1 + continue-on-error: true + with: + command: test + args: --all --no-default-features --features ${{ matrix.feature }} + + lints: + name: Rust lints + runs-on: ubuntu-latest + strategy: + matrix: + feature: [libp2p, waku] + 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 + continue-on-error: true + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + continue-on-error: true + with: + command: clippy + args: --all --no-default-features --features ${{ matrix.feature }} -- --deny warnings