forked from tauri-apps/tauri
-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (180 loc) · 7.34 KB
/
core-lint-fmt.yml
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
# Copyright 2019-2021 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: clippy and fmt check
on:
push:
branches:
- dev
- next
pull_request:
paths:
- '.github/workflows/core-lint-fmt.yml'
- 'core/**'
- 'examples/**'
- 'tooling/cli.rs/**'
jobs:
workspace_clippy_fmt_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/[email protected]
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/[email protected]
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-core-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D warnings
name: workspace
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
cli_clippy_fmt_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/cli.rs/Cargo.toml --all-targets --all-features -- -D warnings
name: cli
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/[email protected]
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/[email protected]
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli.rs/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
ubuntu-latest-nightly-cargo-cli-
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./tooling/cli.rs/Cargo.toml --all -- --check
core_clippy_check:
runs-on: ubuntu-latest
strategy:
matrix:
feature: [custom-protocol, api-all]
steps:
- uses: actions/checkout@v2
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest'
- name: Get current date
if: matrix.platform == 'windows-latest'
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/[email protected]
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/[email protected]
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-core-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./core/tauri/Cargo.toml --all-targets --features ${{ matrix.feature }} -- -D warnings
name: core