Skip to content

Commit

Permalink
Replace justfile with xtask (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
zarvd authored Aug 30, 2024
1 parent 6ec2ab6 commit f1e31b5
Show file tree
Hide file tree
Showing 15 changed files with 562 additions and 174 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[alias]
xtask = "run --manifest-path ./xtask/Cargo.toml --"
x = "run --manifest-path ./xtask/Cargo.toml --"
59 changes: 32 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,51 @@
name: "CI"
name: CI

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
unit-test:
name: Unit test
lint:
name: Coding style check
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 10
steps:
- name: Checkout code
- name: Checkout Code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
- name: Install rust nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt
- name: Install rust stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run unit tests
- name: Run lint
run: |
just unit-test
cargo x lint
lint:
name: Lint
unit-test:
name: Unit test
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 10
steps:
- name: Checkout code
- name: Checkout Code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run lint
run: just lint
- name: Install required tools
run: |
cargo x install-tools
- name: Run tests
run: |
cargo x test
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install rust stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand All @@ -31,7 +32,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Build Image
run: |
just image ${{ env.IMAGE_TAG }}
cargo x build-docker-image --tag ${{ env.IMAGE_TAG }}
- name: Publish image
run: |
export GHCR_IMAGE=ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
Expand Down
123 changes: 22 additions & 101 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ anyhow = "1.0.82"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18" }
tower-http = { version = "0.5.2", features = ["add-extension", "trace", "cors", "timeout"] }
tokio = { version = "1.37.0", features = ["rt-multi-thread", "signal", "macros", "net", "io-util"] }
tokio = { version = "1.40.0", features = ["rt-multi-thread", "signal", "macros", "net", "io-util"] }
axum = { version = "0.7.5" }
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM rust:1.77-buster AS builder
FROM rust:1.80-bookworm AS builder

WORKDIR /workspace
COPY . .

RUN cargo build --release

FROM debian:buster-slim
FROM debian:bookworm-slim

COPY --from=builder /workspace/target/release/echoserver /usr/local/bin/echoserver

Expand Down
Loading

0 comments on commit f1e31b5

Please sign in to comment.