Skip to content

Commit

Permalink
build: use just
Browse files Browse the repository at this point in the history
  • Loading branch information
hseeberger committed Oct 11, 2023
1 parent 17391c3 commit 82d1d74
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 30 deletions.
57 changes: 27 additions & 30 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,44 @@
name: CI
name: ci

on:
push:
branches: [main]
branches:
- main
tags-ignore:
- v*

pull_request:
branches: [main]
branches:
- main

jobs:
test:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3

# Nightly needed for `cargo +nightly fmt` below
- name: Install Rust toolchain
run: |
rustup update
rustup toolchain install nightly
rustup toolchain install nightly --profile minimal
rustup component add rustfmt --toolchain nightly
rustup component add clippy --toolchain nightly
# rustup component add clippy --toolchain nightly
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
- name: Install just
uses: taiki-e/install-action@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Check code format (cargo fmt)
run: cargo +nightly fmt --check

- name: Lint (cargo clippy)
run: cargo clippy --no-deps -- -D warnings

- name: Test (cargo test)
env:
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
run: |
printenv GCP_SERVICE_ACCOUNT > pub-sub-client-tests/secrets/active-road-365118-2eca6b7b8fd9.json
cargo test
tool: just

- name: Set up Rust cache
uses: Swatinem/rust-cache@v2

- name: Check code format
run: just fmt_check

- name: Run linter
run: just lint

- name: Run tests
run: just test
18 changes: 18 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set shell := ["bash", "-uc"]

check:
cargo check --tests

fmt:
cargo +nightly fmt

fmt_check:
cargo +nightly fmt --check

lint:
cargo clippy --no-deps -- -D warnings

test:
cargo test

all: fmt check lint test

0 comments on commit 82d1d74

Please sign in to comment.