-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (68 loc) · 1.83 KB
/
Copy pathrust.yml
File metadata and controls
85 lines (68 loc) · 1.83 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
81
82
83
84
85
name: Rust
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test & Build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: nmcscan
POSTGRES_PASSWORD: nmcscan_secret
POSTGRES_DB: nmcscan_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: ". -> target"
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy (warnings as errors)
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test --verbose
- name: Build release
run: cargo build --release --verbose
- name: Verify binary
run: |
file target/release/nmcscan
target/release/nmcscan --help
docker:
name: Docker Build
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: nmcscan:latest
cache-from: type=gha
cache-to: type=gha,mode=max