-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (147 loc) · 4.65 KB
/
Copy pathci.yml
File metadata and controls
175 lines (147 loc) · 4.65 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: CI
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
release:
types: [created]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux-x86_64
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
platform: linux-aarch64
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings
- os: macos-latest
target: x86_64-apple-darwin
platform: macos-x86_64
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings
- os: macos-latest
target: aarch64-apple-darwin
platform: macos-aarch64
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: -D warnings
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install system dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
crossbuild-essential \
libxcb1-dev \
libxcb-render0-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
ripgrep \
fd-find
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target/${{ matrix.target }}
key: ${{ runner.os }}-${{ matrix.platform }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.platform }}-cargo-
- name: Build binary
run: |
cargo build --release --target ${{ matrix.target }}
chmod +x target/${{ matrix.target }}/release/fishez
- name: Get version
id: version
run: |
VERSION=$(grep '^version = ' Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Package binary
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/fishez dist/fishez-${{ matrix.platform }}
chmod +x dist/fishez-${{ matrix.platform }}
ls -lh dist/
- name: Run tests (macOS native)
if: runner.os == 'macOS'
run: cargo test
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: fishez-${{ matrix.platform }}
path: dist/fishez-${{ matrix.platform }}
retention-days: 7
- name: Upload binary to release (if on tag)
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: dist/fishez-${{ matrix.platform }}
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ripgrep fd-find xdg-utils libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: cargo fmt
run: cargo fmt -- --check
- name: cargo check
run: cargo check
- name: cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: cargo test
env:
FISHEZ_RUN_OPEN_TESTS: "1"
FISHEZ_RUN_TRASH_TESTS: "1"
run: cargo test
- name: cargo tree check
run: cargo tree
- name: cargo doc (HTML output)
run: cargo doc --no-deps --document-private-items
- name: Verify docs build
run: test -f target/doc/fishez/index.html
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Verify artifacts
run: |
echo "Available artifacts:"
find dist -name "fishez-*" -exec ls -lh {} \;