forked from getomnico/omni
-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (150 loc) · 4.74 KB
/
Copy pathbuild-cli.yml
File metadata and controls
178 lines (150 loc) · 4.74 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
176
177
178
name: Build Omni CLI
on:
workflow_call:
permissions:
contents: write
jobs:
test:
name: Test CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
- name: Test CLI
run: cargo test -p omni-cli --locked
build-linux:
name: Build ${{ matrix.asset-name }}
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
asset-name: omni-linux-x86_64
- target: aarch64-unknown-linux-musl
asset-name: omni-linux-arm64
steps:
- uses: actions/checkout@v6
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
key: linux-${{ matrix.target }}
- name: Build CLI
run: cross build --release -p omni-cli --target ${{ matrix.target }} --locked
- name: Stage artifact
run: |
cp target/${{ matrix.target }}/release/omni ${{ matrix.asset-name }}
chmod +x ${{ matrix.asset-name }}
shasum -a 256 ${{ matrix.asset-name }} > ${{ matrix.asset-name }}.sha256
- name: Upload workflow artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.asset-name }}
path: |
${{ matrix.asset-name }}
${{ matrix.asset-name }}.sha256
- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
${{ matrix.asset-name }}
${{ matrix.asset-name }}.sha256
build-macos:
name: Build ${{ matrix.asset-name }}
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
target: x86_64-apple-darwin
asset-name: omni-macos-x86_64
- os: macos-14
target: aarch64-apple-darwin
asset-name: omni-macos-arm64
steps:
- uses: actions/checkout@v6
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
key: macos-${{ matrix.target }}
- name: Build CLI
run: cargo build --release -p omni-cli --target ${{ matrix.target }} --locked
- name: Stage artifact
run: |
cp target/${{ matrix.target }}/release/omni ${{ matrix.asset-name }}
chmod +x ${{ matrix.asset-name }}
shasum -a 256 ${{ matrix.asset-name }} > ${{ matrix.asset-name }}.sha256
- name: Upload workflow artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.asset-name }}
path: |
${{ matrix.asset-name }}
${{ matrix.asset-name }}.sha256
- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
${{ matrix.asset-name }}
${{ matrix.asset-name }}.sha256
build-windows:
name: Build omni-windows-x86_64.exe
needs: test
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
- name: Build CLI
run: cargo build --release -p omni-cli --locked
- name: Stage artifact
shell: pwsh
run: |
Copy-Item target/release/omni.exe omni-windows-x86_64.exe
Get-FileHash omni-windows-x86_64.exe -Algorithm SHA256 | ForEach-Object { "$($_.Hash.ToLower()) omni-windows-x86_64.exe" } | Set-Content omni-windows-x86_64.exe.sha256
- name: Upload workflow artifact
uses: actions/upload-artifact@v7
with:
name: omni-windows-x86_64.exe
path: |
omni-windows-x86_64.exe
omni-windows-x86_64.exe.sha256
- name: Upload release asset
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
omni-windows-x86_64.exe
omni-windows-x86_64.exe.sha256