Skip to content

Commit

Permalink
.github/: Enforce semantic versioning using cargo-semver-checks (libp…
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Sep 15, 2022
1 parent 5906140 commit 6772879
Showing 1 changed file with 116 additions and 111 deletions.
227 changes: 116 additions & 111 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,35 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
args: [
"--no-default-features",
"--all-features",
"--benches --all-features",
]
args:
[
"--no-default-features",
"--all-features",
"--benches --all-features",
]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}
- name: Install Protoc
uses: arduino/setup-protoc@v1

- name: Install Protoc
uses: arduino/setup-protoc@v1
- uses: actions/checkout@v3

- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
with:
key: ${{ matrix.args }}

- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
with:
key: ${{ matrix.args }}

- run: cargo test --workspace ${{ matrix.args }}
- run: cargo test --workspace ${{ matrix.args }}

test-wasm:
name: Build on WASM
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: [
wasm32-unknown-emscripten,
wasm32-wasi
]
toolchain: [wasm32-unknown-emscripten, wasm32-wasi]
include:
- toolchain: wasm32-unknown-unknown
args: "--features wasm-bindgen"
Expand All @@ -53,137 +50,145 @@ jobs:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1

- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
toolchain: stable
target: ${{ matrix.toolchain }}
override: true
- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
toolchain: stable
target: ${{ matrix.toolchain }}
override: true

- name: Install a recent version of clang
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- name: Install a recent version of clang
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- name: Install CMake
run: sudo apt-get install -y cmake
- name: Install CMake
run: sudo apt-get install -y cmake

- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
with:
key: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
with:
key: ${{ matrix.toolchain }}

- name: Build on ${{ matrix.toolchain }}
# TODO: also run `cargo test`
# TODO: ideally we would build `--workspace`, but not all crates compile for WASM
run: cargo build --target=${{ matrix.toolchain }} ${{ matrix.args }}
- name: Build on ${{ matrix.toolchain }}
# TODO: also run `cargo test`
# TODO: ideally we would build `--workspace`, but not all crates compile for WASM
run: cargo build --target=${{ matrix.toolchain }} ${{ matrix.args }}

check-rustdoc-links:
name: Check rustdoc intra-doc links
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1

- uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true

- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0

- name: Check rustdoc links
run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items --all-features
- name: Check rustdoc links
run: RUSTDOCFLAGS="--deny broken_intra_doc_links" cargo doc --verbose --workspace --no-deps --document-private-items --all-features

check-clippy:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}
- name: Install Protoc
uses: arduino/setup-protoc@v1

- name: Install Protoc
uses: arduino/setup-protoc@v1
- uses: actions/checkout@v3

- uses: actions/checkout@v3
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
components: clippy

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0

- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0

- name: Run cargo clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: custom-clippy # cargo alias to allow reuse of config locally
- name: Run cargo clippy
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: custom-clippy # cargo alias to allow reuse of config locally

integration-test:
name: Integration tests
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1

- uses: actions/checkout@v3
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true

- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # v2.0.0

- name: Run ipfs-kad example
run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad
- name: Run ipfs-kad example
run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad

rustfmt:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}

- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@bb6001c4ea612bf59c3abfc4756fbceee4f870c7 # 0.10.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3

- uses: actions/checkout@v3
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- name: Check formatting
run: cargo fmt -- --check

rustsemver:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b # 0.9.1
with:
access_token: ${{ github.token }}

- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions/checkout@v3

- name: Check formatting
run: cargo fmt -- --check
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v1

0 comments on commit 6772879

Please sign in to comment.