-
Notifications
You must be signed in to change notification settings - Fork 7
225 lines (192 loc) · 6.58 KB
/
Copy pathrust.yml
File metadata and controls
225 lines (192 loc) · 6.58 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Rust
on:
push:
branches: [ master ]
paths-ignore:
- 'README.md'
- '**/*.nix'
- 'nix/envrc'
- 'flake.lock'
pull_request:
branches: [ master ]
paths-ignore:
- 'README.md'
- '**/*.nix'
- 'nix/envrc'
- 'flake.lock'
env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
jobs:
tagref:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install tagref
run: curl -L https://github.com/stepchowfun/tagref/releases/download/v1.5.0/tagref-x86_64-unknown-linux-gnu > tagref && chmod +x tagref
- name: Check tagref
run: ./tagref && ./tagref list-unused
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-2019, macOS-latest]
continue-on-error: ${{ matrix.os == 'windows-2019' }}
needs: tagref
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update -yy
sudo apt install -yy --no-install-recommends clang libgtk-3-0 libgtk-3-dev protobuf-compiler libpango1.0-0 libpango1.0-dev libglib2.0-0 libglib2.0-dev python3 pkg-config cmake openssl libx11-dev libxcb1-dev libfreetype6 libfreetype6-dev fontconfig libfontconfig-dev expat libcairo2-dev libcairo2 libatk1.0-0 libatk1.0-dev libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-dev libxcb-shape0 libxcb-shape0-dev libxcb-xfixes0 libxcb-xfixes0-dev clang lld unzip
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-01-17
override: true
profile: minimal
components: rustfmt, clippy
- name: Cache rust
uses: Swatinem/rust-cache@v1
with:
key: cache-debug-3
- name: Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: 'clippy (${{ matrix.os }})'
build-web:
runs-on: ubuntu-latest
needs: check
if: github.event_name == 'push'
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-01-17
override: true
target: wasm32-unknown-unknown
profile: minimal
components: rustfmt, clippy
- name: Cache rust
uses: Swatinem/rust-cache@v1
with:
key: cache-release-web-2
- name: Install trunk
run: cargo install --locked --git "https://github.com/kristoff3r/trunk.git" --branch rust_worker trunk
- name: Write release cargo config
run: cat .cargo/.config-release.toml >> .cargo/config.toml
- name: Build
run: trunk build --release
- uses: montudor/action-zip@v1
with:
args: zip -r dist.zip dist/
- name: Artifact web
uses: actions/upload-artifact@v3
with:
name: build-web
path: dist.zip
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-2019, macOS-latest]
needs: check
if: github.event_name == 'push'
continue-on-error: ${{ matrix.os == 'windows-2019' }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update -yy
sudo apt install -yy --no-install-recommends clang libgtk-3-0 libgtk-3-dev protobuf-compiler libpango1.0-0 libpango1.0-dev libglib2.0-0 libglib2.0-dev python3 pkg-config cmake openssl libx11-dev libxcb1-dev libfreetype6 libfreetype6-dev fontconfig libfontconfig-dev expat libcairo2-dev libcairo2 libatk1.0-0 libatk1.0-dev libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-dev libxcb-shape0 libxcb-shape0-dev libxcb-xfixes0 libxcb-xfixes0-dev clang lld unzip
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-01-17
override: true
profile: minimal
components: rustfmt, clippy
- name: Cache rust
uses: Swatinem/rust-cache@v1
with:
key: cache-release-3
- name: Build
run: cargo build --locked --release
- name: UPX windows
if: ${{ matrix.os == 'windows-2019' }}
run: .github/upx.exe target/release/loqui.exe
- name: UPX linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: .github/upx target/release/loqui
- name: Artifact macOS
if: ${{ matrix.os == 'macOS-latest' }}
uses: actions/upload-artifact@v3
with:
name: build-macos
path: target/release/loqui
- name: Artifact Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: build-linux
path: target/release/loqui
- name: Artifact Windows
if: ${{ matrix.os == 'windows-2019' }}
uses: actions/upload-artifact@v3
with:
name: build-windows
path: target/release/loqui.exe
upload-release:
if: github.event_name == 'push'
needs: [ build, build-web ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- name: Display structure of downloaded files
run: ls -R
- name: Rename artifacts
run: |
#mv build-windows/loqui.exe build-windows/loqui-windows.exe
mv build-linux/loqui build-linux/loqui-linux
mv build-macos/loqui build-macos/loqui-macos
mv build-web/dist.zip build-web/web-dist.zip
chmod +x build-{linux,macos}/*
- name: Upload release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage build-linux/loqui-linux build-macos/loqui-macos build-web/web-dist.zip
deploy-web:
if: github.event_name == 'push'
needs: upload-release
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
repository: 'harmony-development/ansible'
- run: 'echo "$SSH_KEY" > key && chmod 600 key'
shell: bash
env:
SSH_KEY: ${{secrets.ACTIONS_SSH_KEY}}
- run: 'echo "$KNOWN_HOSTS" > known_hosts && chmod 600 known_hosts'
shell: bash
env:
KNOWN_HOSTS: ${{secrets.ACTIONS_SSH_KNOWN_HOSTS}}
- run: 'ansible-playbook only-loqui.yml --key-file key'
shell: bash
env:
SSH_HOST: ${{secrets.ACTIONS_SSH_HOST}}