Skip to content

Commit

Permalink
build: use just for GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hseeberger committed Sep 29, 2023
1 parent 6ca14fe commit 5fdcaa5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- main

jobs:
fmt-lint-test:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out
Expand All @@ -26,17 +26,22 @@ jobs:
rustup component add rustfmt --toolchain nightly
# rustup component add clippy --toolchain nightly
- name: Install just
uses: taiki-e/install-action@v2
with:
tool: just

- name: Install protoc
uses: arduino/setup-protoc@v2

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

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

- name: Lint (cargo clippy)
run: cargo clippy --no-deps -- -D warnings
- name: Run linter
run: just lint

- name: Test (cargo test)
run: cargo test
- name: Run tests
run: just test
2 changes: 1 addition & 1 deletion hello-tracing-backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=1.70.0
ARG RUST_VERSION=1.72.1

FROM rust:${RUST_VERSION}-bullseye AS builder
RUN apt-get update && \
Expand Down
2 changes: 1 addition & 1 deletion hello-tracing-gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=1.70.0
ARG RUST_VERSION=1.72.1

FROM rust:${RUST_VERSION}-bullseye AS builder
RUN apt-get update && \
Expand Down
7 changes: 3 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
set shell := ["bash", "-uc"]

rust_version := `grep 'rust-version' Cargo.toml | grep -Eo '\d+\.\d+\.\d+'`

check:
cargo check --tests

fmt:
cargo +nightly fmt

fmt_check:
cargo +nightly fmt --check

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

Expand All @@ -33,12 +34,10 @@ run-backend:

docker:
docker build \
--build-arg RUST_VERSION={{rust_version}} \
-t hseeberger/hello-tracing-backend \
-f hello-tracing-backend/Dockerfile \
.
docker build \
--build-arg RUST_VERSION={{rust_version}} \
-t hseeberger/hello-tracing-gateway \
-f hello-tracing-gateway/Dockerfile \
.

0 comments on commit 5fdcaa5

Please sign in to comment.