Repository navigation
233 lines (209 loc) · 6.82 KB
/
Copy pathci.yml
File metadata and controls
233 lines (209 loc) · 6.82 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
226
227
228
229
230
231
232
233
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches:
- main
- 'patch-release-*'
name: Continuous Integration
permissions:
contents: read
env:
NU_BUILD_PR: ${{ github.event.pull_request.html_url }}
NU_LOG_LEVEL: DEBUG
NU_TEST_SKIP_DEPS_BUILD: true
NUSHELL_CARGO_PROFILE: ci
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
root:
name: ${{ matrix.platform.name }} / root
runs-on: ${{ matrix.platform.runner }}
# Do not run CI on draft PRs or on the lower layers of stacked PRs
if: &job_if >-
!github.event.pull_request.draft &&
(
github.event.pull_request.stack == null ||
github.event.pull_request.stack.position ==
github.event.pull_request.stack.size
)
env:
build-target: ${{ matrix.platform.target }}
working-directory: ${{ github.workspace }}
cargo-options: --workspace --all-targets
profile: ci
strategy:
matrix:
platform: &platforms
- name: Linux
runner: &runner_linux incredibuild-ubuntu-2204
target: &target_linux x86_64-unknown-linux-gnu
- name: Windows
runner: &runner_windows incredibuild-windows-2022
target: &target_windows x86_64-pc-windows-msvc
- name: MacOS
runner: &runner_macos macos-latest
target: &target_macos x86_64-apple-darwin
steps:
- &step_checkout_repo
name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- &step_setup_rust_toolchain
name: Setup Rust Toolchain
run: rustup target add ${{ env.build-target }}
working-directory: ${{ env.working-directory }}
- &step_cache_rust
name: Cache Rust
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
workspaces: ${{ env.working-directory }} -> target
cache-all-crates: true
cache-workspace-crates: true
- &step_fmt
name: Fmt
working-directory: ${{ env.working-directory }}
run: |
rustup component add rustfmt
cargo fmt --all --check
- &step_check
name: Check
working-directory: ${{ env.working-directory }}
run: >-
cargo --config "${{ github.workspace }}/.cargo/ci.toml"
check ${{ env.cargo-options }}
--profile ${{ env.profile }}
- &step_clippy
name: Clippy
working-directory: ${{ env.working-directory }}
run: >-
rustup component add clippy
cargo --config "${{ github.workspace }}/.cargo/ci.toml"
clippy ${{ env.cargo-options }}
--profile ${{ env.profile }}
-- -D warnings
- &step_build
name: Build
working-directory: ${{ env.working-directory }}
run: >-
cargo --config "${{ github.workspace }}/.cargo/ci.toml"
build ${{ env.cargo-options }}
--profile ${{ env.profile }}
- &step_test
name: Test
working-directory: ${{ env.working-directory }}
run: >-
cargo --config "${{ github.workspace }}/.cargo/ci.toml"
test ${{ env.cargo-options }}
--profile ${{ env.profile }}
- &step_doctest
name: Doctest
working-directory: ${{ env.working-directory }}
run: >-
cargo --config "${{ github.workspace }}/.cargo/ci.toml"
test --workspace --doc
--profile ${{ env.profile }}
- &step_add_nushell_to_path
name: Add Nushell to PATH
shell: bash
env:
NU_HOME: ${{ env.working-directory }}/target/${{ env.profile }}
run: printf '%s\n' "${NU_HOME}" >> "$GITHUB_PATH"
- &step_test_std
name: Test Std
run: nu -n -c 'use crates/nu-std/testing.nu; testing run-tests --path crates/nu-std'
- &step_setup_python
name: Setup Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.10"
- &step_install_virtualenv
name: Install virtualenv
run: pip install virtualenv
- &step_test_virtualenv
name: Test virtualenv
run: nu scripts/test_virtualenv.nu
- &step_upload_artifacts
name: Upload Artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
env:
OS_NAMES: '{"Windows":"windows","Linux":"linux","macOS":"macos"}'
ARCH_NAMES: '{"X86":"x86","X64":"x86_64","ARM":"arm","ARM64":"aarch64"}'
with:
name: &artifact_name >-
${{ format('nu-{0}-{1}-{2}',
github.event.number || github.ref_name,
fromJSON(env.OS_NAMES)[runner.os],
fromJSON(env.ARCH_NAMES)[runner.arch]) }}
path: |
${{ format('{0}/target/{1}/nu',
env.working-directory || github.workspace,
env.profile || 'ci') }}
${{ format('{0}/target/{1}/nu.exe',
env.working-directory || github.workspace,
env.profile || 'ci') }}
retention-days: 14
- &step_assert_clean_repo
name: Assert Clean Repo
shell: bash
run: test -z "$(git status --porcelain)"
root_wasm:
name: WASM / root
runs-on: *runner_linux
if: *job_if
env:
build-target: wasm32-unknown-unknown
working-directory: ${{ github.workspace }}
profile: ci
cargo-options: >-
--no-default-features
--target wasm32-unknown-unknown
-p nu-cmd-base
-p nu-cmd-extra
-p nu-cmd-lang
-p nu-color-config
-p nu-command
-p nu-derive-value
-p nu-engine
-p nu-glob
-p nu-json
-p nu-parser
-p nu-path
-p nu-pretty-hex
-p nu-protocol
-p nu-std
-p nu-system
-p nu-table
-p nu-term-grid
-p nu-utils
-p nuon
steps:
- *step_checkout_repo
- *step_setup_rust_toolchain
- *step_cache_rust
- *step_check
- *step_build
- *step_assert_clean_repo
fuzz:
name: ${{ matrix.platform.name }} / ${{ matrix.crate }} / fuzz
runs-on: ${{ matrix.platform.runner }}
if: *job_if
env:
build-target: ${{ matrix.platform.target }}
working-directory: ${{ github.workspace }}/crates/${{ matrix.crate }}/fuzz
profile: dev
cargo-options: --all-targets
strategy:
matrix:
platform: *platforms
crate:
- nu-parser
- nu-path
steps:
- *step_checkout_repo
- *step_setup_rust_toolchain
- *step_cache_rust
- *step_fmt
- *step_check
- *step_clippy
- *step_assert_clean_repo