Skip to content

Commit 4bef60f

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

File tree

26 files changed

+218
-415
lines changed

26 files changed

+218
-415
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,50 @@
1-
name: Docker
1+
name: CI/CD
2+
23
on:
34
push:
4-
branches:
5-
- "main"
6-
tags:
7-
- "*"
8-
workflow_dispatch:
5+
branches: [ main ]
6+
tags: [ '*' ]
7+
pull_request:
8+
99
env:
1010
REGISTRY: ghcr.io
1111
IMAGE_NAME: ${{ github.repository }}
12+
1213
jobs:
14+
check:
15+
name: Nix CI
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: cachix/install-nix-action@v24
20+
with:
21+
nix_path: nixpkgs=channel:nixos-unstable
22+
- uses: DeterminateSystems/magic-nix-cache-action@v2
23+
- run: nix flake check
24+
- run: nix build
25+
26+
build:
27+
name: Build Binary
28+
needs: check
29+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: cachix/install-nix-action@v24
34+
with:
35+
nix_path: nixpkgs=channel:nixos-unstable
36+
- uses: DeterminateSystems/magic-nix-cache-action@v2
37+
- run: nix build
38+
- run: mkdir -p target/release && cp result/bin/testaustime target/release/testaustime-rs
39+
- uses: actions/upload-artifact@v4
40+
with:
41+
name: build
42+
path: target/release/testaustime-rs
43+
1344
build-image:
1445
name: Build Docker image
46+
needs: check
47+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
1548
strategy:
1649
matrix:
1750
runner:
@@ -23,7 +56,7 @@ jobs:
2356
packages: write
2457
steps:
2558
- name: Checkout repository
26-
uses: actions/checkout@v3
59+
uses: actions/checkout@v4
2760

2861
- name: Install Nix
2962
uses: cachix/install-nix-action@v24
@@ -81,7 +114,8 @@ jobs:
81114
82115
- name: Tag and push Docker image
83116
run: |
84-
for tag in ${{ steps.meta.outputs.tags }}; do
117+
for tag in ${{ steps.meta.outputs.tags }};
118+
do
85119
docker tag ${{ steps.image.outputs.name }} $tag
86120
docker push $tag
87121
done
@@ -117,7 +151,8 @@ jobs:
117151
- name: Create and push manifest
118152
run: |
119153
TAGS="${{ steps.meta.outputs.tags }}"
120-
for tag in $TAGS; do
154+
for tag in $TAGS;
155+
do
121156
docker manifest create $tag \
122157
${tag}-amd64 \
123158
${tag}-arm64

.github/workflows/rust.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

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)