-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (103 loc) · 3.22 KB
/
ci.yml
File metadata and controls
123 lines (103 loc) · 3.22 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
jobs:
check:
name: Format + Lint + Test + Build
runs-on: blacksmith-32vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
- name: Install mold linker
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- name: Cache cargo registry + target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: check-${{ runner.os }}-nightly-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
check-${{ runner.os }}-nightly-
- name: Check formatting
run: cargo +nightly fmt --all -- --check
- name: Clippy
run: cargo +nightly clippy --all-targets -- -D warnings
- name: Run tests
run: cargo +nightly test --release -j $(nproc) -- --test-threads=$(nproc)
env:
RUST_LOG: warn
- name: Build release
run: cargo +nightly build --release -j $(nproc)
env:
RUSTFLAGS: "-C debuginfo=0 -C link-arg=-fuse-ld=mold -D warnings"
- name: Upload binary
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: term-executor-linux-x86_64
path: target/release/term-executor
retention-days: 7
docker:
name: Docker build
runs-on: blacksmith-32vcpu-ubuntu-2404
needs: [check]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Lowercase repo name
id: lower
run: echo "repo=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ steps.lower.outputs.repo }}:latest
ghcr.io/${{ steps.lower.outputs.repo }}:${{ github.sha }}
release:
name: Semantic Release
runs-on: ubuntu-latest
needs: [check]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: write
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install semantic-release
run: npm install -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/exec
- name: Run semantic-release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}