2023-09-01 07:45:53 +00:00
|
|
|
# copy of https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
|
|
|
|
# Steps for checking PRs.
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "*"
|
2023-09-22 08:19:56 +00:00
|
|
|
push:
|
2024-03-22 09:06:37 +00:00
|
|
|
branches: [ master ]
|
2023-09-01 07:45:53 +00:00
|
|
|
|
|
|
|
name: PR check
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
name: Check
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
2024-03-22 09:06:37 +00:00
|
|
|
feature: [ libp2p, "libp2p,mixnet" ]
|
2023-09-01 07:45:53 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
2024-07-23 15:24:21 +00:00
|
|
|
- uses: arduino/setup-protoc@v3
|
2024-07-24 15:59:47 +00:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2023-09-01 07:45:53 +00:00
|
|
|
- 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:
|
2024-03-22 09:06:37 +00:00
|
|
|
feature: [ libp2p, "libp2p,mixnet" ]
|
|
|
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
2023-09-01 07:45:53 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
2024-07-23 15:24:21 +00:00
|
|
|
- uses: arduino/setup-protoc@v3
|
2024-07-24 15:59:47 +00:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2023-09-04 07:27:13 +00:00
|
|
|
# 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:
|
2024-03-22 09:06:37 +00:00
|
|
|
toolchain: stable-msvc
|
|
|
|
target: x86_64-pc-windows-msvc
|
2023-09-04 07:27:13 +00:00
|
|
|
override: true
|
|
|
|
# Setup Rust toolchain for other OSes
|
|
|
|
- name: Setup Rust toolchain (Other OSes)
|
|
|
|
if: matrix.os != 'windows-latest'
|
|
|
|
uses: actions-rs/toolchain@v1
|
2023-09-01 07:45:53 +00:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2023-09-22 06:31:31 +00:00
|
|
|
# Setup build environment (Windows)
|
|
|
|
- name: Setup build environment (Windows)
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
uses: ./.github/actions/mingw-env
|
2023-11-28 00:02:24 +00:00
|
|
|
- name: Cargo build
|
|
|
|
uses: actions-rs/cargo@v1
|
2023-09-01 07:45:53 +00:00
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --all --no-default-features --features ${{ matrix.feature }}
|
2023-11-28 00:02:24 +00:00
|
|
|
- name: Cargo test (Other OSes)
|
2024-03-19 10:15:09 +00:00
|
|
|
if: matrix.os != 'windows-latest'
|
2023-11-28 00:02:24 +00:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --all --no-default-features --features ${{ matrix.feature }}
|
|
|
|
- name: Cargo test (Windows)
|
2024-03-19 10:15:09 +00:00
|
|
|
if: matrix.os == 'windows-latest'
|
2023-11-28 00:02:24 +00:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
env:
|
|
|
|
# Because Windows runners in Github Actions tend to be slow.
|
|
|
|
SLOW_TEST_ENV: true
|
2023-09-01 07:45:53 +00:00
|
|
|
with:
|
|
|
|
command: test
|
2023-09-19 09:00:27 +00:00
|
|
|
args: --all --no-default-features --features ${{ matrix.feature }}
|
2023-11-07 00:38:10 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: integration-test-artifacts
|
|
|
|
path: tests/.tmp*
|
2023-09-01 07:45:53 +00:00
|
|
|
|
|
|
|
lints:
|
|
|
|
name: Rust lints
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-03-22 09:06:37 +00:00
|
|
|
feature: [ libp2p, "libp2p,mixnet" ]
|
2023-09-01 07:45:53 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
2024-07-23 15:24:21 +00:00
|
|
|
- uses: arduino/setup-protoc@v3
|
2024-07-24 15:59:47 +00:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2023-09-01 07:45:53 +00:00
|
|
|
- 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
|