Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 47 additions & 36 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,60 @@
name: Test Code
name: Build and Test

on:
pull_request:
branches:
- main
types: [synchronize, ready_for_review]
push:
branches:
- main
- main

jobs:
test-code:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Protoc
uses: arduino/setup-protoc@v1

# Steps taken from https://github.com/actions/cache/blob/master/examples.md#rust---cargo
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt, clippy
target: wasm32-unknown-unknown
override: true
default: true
- name: Free up space on runner
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"

- name: Rust Setup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
components: rustfmt, clippy

- name: Install protoc
run: |
sudo apt-get install -y protobuf-compiler
protoc --version

- uses: actions/checkout@v3

- name: Rustfmt
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: fmt
args: --all --check

- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.0
with:
cache-on-failure: true
cache-all-crates: true

- name: Check Build
run: |
cargo check --release

- name: Run tests
run: cargo test --release --locked --verbose --all

# Enable this for clippy linting.
# - name: Check and Lint Code
# run: cargo +nightly clippy -- -D warnings

- name: Check Code
run: cargo check

- name: Test Code
run: cargo test
# run: cargo clippy -- -D warnings
Loading