Skip to content

Commit c19dd6d

Browse files
committed
chore: use nix in the entire CI, formatting and clippy fixes
1 parent a1ad0b0 commit c19dd6d

File tree

26 files changed

+196
-384
lines changed

26 files changed

+196
-384
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ on:
1212
jobs:
1313
build:
1414
name: Build
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions-rs/toolchain@v1
17+
- uses: actions/checkout@v4
18+
- uses: cachix/install-nix-action@v24
1919
with:
20-
profile: minimal
21-
toolchain: nightly
22-
override: true
23-
- uses: actions-rs/cargo@v1
24-
with:
25-
command: build
26-
args: --release
27-
- uses: actions/upload-artifact@v2
20+
nix_path: nixpkgs=channel:nixos-unstable
21+
- uses: DeterminateSystems/magic-nix-cache-action@v2
22+
- run: nix build
23+
- run: mkdir -p target/release && cp result/bin/testaustime target/release/testaustime-rs
24+
- uses: actions/upload-artifact@v4
2825
with:
2926
name: build
30-
path: target/release/testaustime-rs
27+
path: target/release/testaustime-rs

.github/workflows/docker.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
packages: write
2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2727

2828
- name: Install Nix
2929
uses: cachix/install-nix-action@v24
@@ -81,7 +81,8 @@ jobs:
8181
8282
- name: Tag and push Docker image
8383
run: |
84-
for tag in ${{ steps.meta.outputs.tags }}; do
84+
for tag in ${{ steps.meta.outputs.tags }};
85+
do
8586
docker tag ${{ steps.image.outputs.name }} $tag
8687
docker push $tag
8788
done
@@ -122,4 +123,4 @@ jobs:
122123
${tag}-amd64 \
123124
${tag}-arm64
124125
docker manifest push $tag
125-
done
126+
done

.github/workflows/rust.yml

Lines changed: 8 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,14 @@ on: [push, pull_request]
33
name: Continuous integration
44

55
jobs:
6-
check:
7-
name: Check
6+
nix-ci:
7+
name: Nix CI
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions-rs/toolchain@v1
10+
- uses: actions/checkout@v4
11+
- uses: cachix/install-nix-action@v24
1212
with:
13-
profile: minimal
14-
toolchain: nightly
15-
override: true
16-
- uses: actions-rs/cargo@v1
17-
with:
18-
command: check
19-
20-
test:
21-
name: Test Suite
22-
runs-on: ubuntu-latest
23-
24-
services:
25-
postgres:
26-
image: postgres
27-
env:
28-
POSTGRES_DB: testaustime
29-
POSTGRES_PASSWORD: postgres
30-
POSTGRES_USER: postgres
31-
ports:
32-
- 5432:5432
33-
options: >-
34-
--health-cmd pg_isready
35-
--health-interval 10s
36-
--health-timeout 5s
37-
--health-retries 5
38-
39-
steps:
40-
- uses: actions/checkout@v2
41-
- uses: actions-rs/toolchain@v1
42-
with:
43-
profile: minimal
44-
toolchain: nightly
45-
override: true
46-
- name: Install Diesel
47-
run: cargo install diesel_cli --features=postgres
48-
- name: Create Test DB
49-
env:
50-
DATABASE_URL: postgres://postgres:postgres@localhost/testaustime
51-
run: diesel migration run
52-
53-
- name: Run tests
54-
env:
55-
TEST_DATABASE: postgres://postgres:postgres@localhost/testaustime
56-
run: cargo test
57-
58-
fmt:
59-
name: Rustfmt
60-
runs-on: ubuntu-latest
61-
steps:
62-
- uses: actions/checkout@v2
63-
- uses: actions-rs/toolchain@v1
64-
with:
65-
profile: minimal
66-
toolchain: nightly
67-
override: true
68-
- run: rustup component add rustfmt
69-
- uses: actions-rs/cargo@v1
70-
with:
71-
command: fmt
72-
args: --all -- --check
73-
74-
clippy:
75-
name: Clippy
76-
runs-on: ubuntu-latest
77-
steps:
78-
- uses: actions/checkout@v2
79-
- uses: actions-rs/toolchain@v1
80-
with:
81-
profile: minimal
82-
toolchain: nightly
83-
override: true
84-
- run: rustup component add clippy
85-
- uses: actions-rs/cargo@v1
86-
with:
87-
command: clippy
88-
args: -- -D warnings
13+
nix_path: nixpkgs=channel:nixos-unstable
14+
- uses: DeterminateSystems/magic-nix-cache-action@v2
15+
- run: nix flake check
16+
- run: nix build

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
name = "testaustime"
33
version = "0.3.1"
44
edition = "2021"
5-
authors = ["Ville Järvinen <jarvinenville606@gmail.com>", "Luukas Pörtfors <lajp@iki.fi>"]
5+
authors = [
6+
"Ville Järvinen <jarvinenville606@gmail.com>",
7+
"Luukas Pörtfors <lajp@iki.fi>",
8+
]
69

710
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
811
[features]
@@ -15,8 +18,14 @@ lto = true
1518
[dependencies]
1619
axum = { version = "0.8", features = ["macros", "tokio"] }
1720
axum-extra = { version = "0.10", features = ["cookie", "cookie-private"] }
18-
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"]}
19-
reqwest = { version = "0.12", optional = true, default-features = false, features = ["json", "rustls-tls", "charset", "http2", "macos-system-configuration"] }
21+
tokio = { version = "1.35", features = ["macros", "rt-multi-thread"] }
22+
reqwest = { version = "0.12", optional = true, default-features = false, features = [
23+
"json",
24+
"rustls-tls",
25+
"charset",
26+
"http2",
27+
"macos-system-configuration",
28+
] }
2029
http = "1.0"
2130
http-body-util = "0.1"
2231
regex = "1.5"
@@ -25,7 +34,10 @@ tower = "0.5"
2534
tower-http = { version = "0.6", features = ["trace"] }
2635

2736
tracing = "0.1.40"
28-
tracing-subscriber = { version = "0.3", features = ["env-filter", "tracing-log"] }
37+
tracing-subscriber = { version = "0.3", features = [
38+
"env-filter",
39+
"tracing-log",
40+
] }
2941
tracing-futures = "0.2"
3042

3143
thiserror = "2.0"
@@ -39,7 +51,7 @@ futures = "0.3"
3951
futures-util = "0.3"
4052
chrono = { version = "0.4", features = ["serde"] }
4153
dashmap = "6.1"
42-
argon2 = { version = "0.4", features = ["std"]}
54+
argon2 = { version = "0.4", features = ["std"] }
4355
rand = "0.9"
4456
dotenv = "0.15"
4557
url = "2.2"
@@ -48,8 +60,15 @@ itertools = "0.14"
4860
governor = "0.10.0"
4961
diesel = { version = "2.1.0", features = ["chrono", "serde_json"] }
5062
diesel-async = { version = "0.5.1", features = ["postgres", "deadpool"] }
51-
lettre = { version = "0.11.14", default-features = false, features = ["tokio1-rustls-tls", "tracing", "pool", "smtp-transport", "hostname", "builder"]}
63+
lettre = { version = "0.11.14", default-features = false, features = [
64+
"tokio1-rustls-tls",
65+
"tracing",
66+
"pool",
67+
"smtp-transport",
68+
"hostname",
69+
"builder",
70+
] }
5271
mime = "0.3.17"
5372
utoipa = { version = "5.4.0", features = ["axum_extras", "chrono"] }
5473
utoipa-axum = "0.2.0"
55-
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
74+
utoipa-swagger-ui = { version = "9.0.2", features = ["axum", "vendored"] }

0 commit comments

Comments
 (0)