Repository navigation
165 lines (146 loc) · 4.47 KB
/
Copy pathrust.yml
File metadata and controls
165 lines (146 loc) · 4.47 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
name: Rust
on:
push:
branches: [main]
paths:
- "Cargo.toml"
- "Cargo.lock"
- "src/**"
- "devices/**"
- ".github/workflows/rust.yml"
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "src/**"
- "devices/**"
- ".github/workflows/rust.yml"
workflow_dispatch:
release:
types: [created]
schedule:
- cron: "0 14 * * *" # Daily at 2 PM UTC
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.artifact }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: win-x64
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: linux-x64
ext: ""
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
artifact: linux-aarch64
ext: ""
cross: true
- target: aarch64-apple-darwin
os: macos-latest
artifact: macos-arm64
ext: ""
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cargo-zigbuild
if: matrix.cross
uses: taiki-e/install-action@v2
with:
tool: cargo-zigbuild
- name: Install Zig
if: matrix.cross
uses: mlugg/setup-zig@v2
with:
version: 0.13.0
- name: Build (native)
if: ${{ !matrix.cross }}
run: cargo build --release --target ${{ matrix.target }}
- name: Build (cross)
if: matrix.cross
run: cargo zigbuild --release --target ${{ matrix.target }}
- name: Run tests
if: ${{ !matrix.cross }}
run: cargo test --release --target ${{ matrix.target }}
- name: Run help
if: ${{ !matrix.cross }}
run: cargo run --release --target ${{ matrix.target }} -- --help
- name: Prepare artifact
shell: bash
run: |
mkdir -p wchisp-${{ matrix.artifact }}
cp target/${{ matrix.target }}/release/wchisp${{ matrix.ext }} wchisp-${{ matrix.artifact }}/
cp README.md wchisp-${{ matrix.artifact }}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wchisp-${{ matrix.artifact }}
path: wchisp-${{ matrix.artifact }}
- name: Create release archive
if: github.event_name == 'release'
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
7z a -tzip wchisp-${{ github.event.release.tag_name }}-${{ matrix.artifact }}.zip wchisp-${{ matrix.artifact }}
else
tar -czvf wchisp-${{ github.event.release.tag_name }}-${{ matrix.artifact }}.tar.gz wchisp-${{ matrix.artifact }}
fi
- name: Upload release asset
if: github.event_name == 'release'
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: false
files: |
wchisp-*.tar.gz
wchisp-*.zip
nightly-release:
name: Nightly Release
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'schedule'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./
- name: Create archives
run: |
for dir in wchisp-*/; do
name="${dir%/}"
echo "Compressing $name"
if [[ $name == wchisp-win* ]]; then
zip -r "$name.zip" "$name"
else
tar -czvf "$name.tar.gz" "$name"
fi
done
- name: Update nightly release
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: "wchisp nightly release $$"
draft: false
prerelease: true
# Skip republishing when the nightly tag is already at HEAD — avoids
# spamming watchers with empty re-releases on cron runs.
only-when-changed: true
body: |
This is a nightly binary release of the wchisp command line tool.
files: |
wchisp-*.tar.gz
wchisp-*.zip