-
Notifications
You must be signed in to change notification settings - Fork 3
124 lines (102 loc) · 3.22 KB
/
tests.yaml
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
name: Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 7 * * *' # Run every morning at 7am UTC
permissions:
contents: read
jobs:
nutest-tests:
name: Run Tests
permissions:
checks: write
pull-requests: write
strategy:
fail-fast: true
matrix:
version: ["0.101.0", "*", "nightly"] # Earliest supported, latest and nightly
platform: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Nushell Binary
uses: hustcer/setup-nu@v3
with:
version: ${{ matrix.version }}
- name: Test Nutest
shell: nu {0}
run: |
nu -c 'use nutest; (
nutest run-tests
--fail
--display terminal
--report { type: junit, path: test-report.xml }
--returns summary | to json | save --force test-summary.json
)'
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: runner.os == 'Linux' && always()
with:
files: test-report.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/macos@v2
if: runner.os == 'macOS' && always()
with:
files: test-report.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: runner.os == 'Windows' && always()
with:
files: test-report.xml
- name: Publish Test Summary
if: runner.os == 'Linux' && matrix.version == '*' && github.ref == 'refs/heads/main'
shell: nu {0}
run: |
let gist_id = "0cbdca67f966d7ea2e6e1eaf7c9083a3"
let filename = "test-summary.json"
let data = {
files: {
"test-summary.json": {
content: (open --raw $filename)
}
}
}
(
$data | http patch
--redirect-mode "follow"
--content-type "application/json"
--headers {
"Authorization": $"Bearer ${{ secrets.GIST_TOKEN }}"
"Accept": "application/vnd.github+json"
"X-GitHub-Api-Version": "2022-11-28"
}
$"https://api.github.com/gists/($gist_id)"
) | ignore
nushell-tests:
name: Run Nushell Tests
strategy:
fail-fast: true
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Checkout Nushell
uses: actions/checkout@v4
with:
repository: nushell/nushell
ref: main
path: nushell
- name: Install Nushell Binary
uses: hustcer/setup-nu@v3
with:
version: "nightly"
- name: Test Nushell
# Nushell used here so use of workspace directory works consistently across platforms
shell: nu {0}
run: nu -c $"use ($env.GITHUB_WORKSPACE)/nutest; nutest run-tests --fail --path tests"
working-directory: nushell/crates/nu-std