-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (84 loc) · 2.27 KB
/
ci.yml
File metadata and controls
92 lines (84 loc) · 2.27 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
name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
- run: cargo clippy -- -D warnings
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test
build:
name: Build (${{ matrix.name }})
needs: [lint, test]
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- name: linux-x86_64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: ptywrap-linux-x86_64
- name: linux-arm64
runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
artifact: ptywrap-linux-arm64
- name: macos-arm64
runner: macos-14
target: aarch64-apple-darwin
artifact: ptywrap-macos-arm64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- run: cargo build --release
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: target/release/ptywrap
release:
name: Release
if: startsWith(github.ref, 'refs/tags/v')
needs: [build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
for dir in artifacts/ptywrap-*; do
name=$(basename "$dir")
chmod +x "$dir/ptywrap"
tar -czf "${name}.tar.gz" -C "$dir" ptywrap
shasum -a 256 "${name}.tar.gz" >> checksums.txt
done
- uses: softprops/action-gh-release@v2
with:
files: |
ptywrap-*.tar.gz
checksums.txt
generate_release_notes: true