Skip to content

Commit 2e039b3

Browse files
committed
feat: github actions
1 parent f44aecb commit 2e039b3

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Rust CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
build-test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Rust
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
override: true
21+
components: clippy, rustfmt
22+
23+
- name: Cache cargo
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
~/.cargo/registry
28+
~/.cargo/git
29+
target
30+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
31+
32+
- name: Build
33+
run: cargo build --verbose
34+
35+
- name: Run tests
36+
run: cargo test --all --verbose
37+
38+
- name: Lint (clippy)
39+
run: cargo clippy -- -D warnings
40+
41+
- name: Check format
42+
run: cargo fmt -- --check
43+
44+
release:
45+
if: github.ref == 'refs/heads/main'
46+
runs-on: ubuntu-latest
47+
needs: build-test
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: actions-rs/toolchain@v1
51+
with:
52+
toolchain: stable
53+
override: true
54+
- name: Build release binary
55+
run: cargo build --release
56+
- name: Upload artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: github-exporter
60+
path: target/release/github-exporter

0 commit comments

Comments
 (0)