forked from mpiorowski/late-sh
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (74 loc) · 2.1 KB
/
ci.yml
File metadata and controls
80 lines (74 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: ci
on:
workflow_call:
inputs:
package:
description: "Cargo package to check (empty = whole workspace)"
required: false
type: string
default: ""
permissions:
contents: read
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v5
- name: install_rustfmt
run: rustup component add rustfmt
- name: cargo_fmt_check
run: cargo fmt --all -- --check
clippy-test:
name: clippy + test
needs: [fmt]
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
steps:
- name: checkout
uses: actions/checkout@v5
- name: install_linux_build_dependencies
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev pkg-config mold
- name: restore_rust_cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ci-rust
- name: install_clippy
run: rustup component add clippy
- name: cargo_clippy
env:
CARGO_PACKAGE: ${{ inputs.package }}
run: |
package_args=(--workspace)
if [ -n "$CARGO_PACKAGE" ]; then
package_args=(-p "$CARGO_PACKAGE")
fi
cargo clippy "${package_args[@]}" --all-targets --features otel -- -D warnings
- name: install_nextest
uses: taiki-e/install-action@nextest
- name: cargo_test
env:
TEST_DATABASE_URL: "host=127.0.0.1 port=5432 user=test password=test dbname=postgres"
CARGO_PACKAGE: ${{ inputs.package }}
run: |
package_args=(--workspace)
if [ -n "$CARGO_PACKAGE" ]; then
package_args=(-p "$CARGO_PACKAGE")
fi
cargo nextest run "${package_args[@]}" --all-targets