Skip to content

Commit

Permalink
rework CI
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Sep 19, 2023
1 parent 41ae03e commit 99b6bd7
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,53 @@ on:
push:
pull_request:

env:
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: "1G"

jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
name: lite-rpc full build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Install Dependencies
- name: Install Linux Packages
run: |
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install libssl-dev openssl -y
- name: Early Build
run: cargo build --workspace --tests
- uses: actions/checkout@v4

# The toolchain action should definitely be run before the cache action
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# use toolchain version from rust-toolchain.toml
components: rustfmt, clippy
cache: true
# avoid the default "-D warnings" which thrashes cache
rustflags: ""

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Check Rust Code Format
run: cargo fmt -- --check
# https://github.com/actions/cache/blob/main/examples.md#rust---cargo
# https://blog.arriven.wtf/posts/rust-ci-cache/
- uses: Swatinem/rust-cache@v2
with:
# will be covered by sscache
cache-targets: false
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}


- name: Early Build
run: |
cargo build --locked --workspace --all-targets
- name: Run Rust Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Run fmt+clippy
run: |
cargo fmt --all --check
cargo clippy --locked --workspace --all-targets
- name: Run Tests
run: RUST_LOG=info cargo test
Expand Down

0 comments on commit 99b6bd7

Please sign in to comment.