Tests #151
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |