.github/workflows/nupm-tests.yml #7
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
# reusable workflow to be able to provide defaults to the CI | |
on: | |
workflow_dispatch: | |
inputs: | |
nu_version: | |
description: "A semver, e.g. `0.12.3`, or `nightly` for the latest revision of Nushell." | |
required: true | |
type: string | |
nupm_revision: | |
description: "A commit hash, branch name or tag to checkout before installing Nupm." | |
required: true | |
type: string | |
workflow_call: | |
inputs: | |
nu_version: | |
description: "A semver, e.g. `0.12.3`, or `nightly` for the latest revision of Nushell." | |
required: true | |
type: string | |
nupm_revision: | |
description: "A commit hash, branch name or tag to checkout before installing Nupm." | |
required: true | |
type: string | |
env: | |
NU_LOG_LEVEL: DEBUG | |
GITHUB_TOKEN: ${{ github.token }} | |
defaults: | |
run: | |
shell: nu {0} | |
jobs: | |
nupm-tests: | |
strategy: | |
fail-fast: true | |
matrix: | |
platform: [windows-latest, macos-latest, ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Nushell and Nupm versions | |
shell: bash | |
run: | | |
echo "target: ${{github.base_ref}}" | |
echo "ref: ${{github.ref}}" | |
if [[ '${{ github.base_ref }}' == 'nightly' ]]; then | |
echo "NU_VERSION=nightly" >> $GITHUB_ENV | |
echo "NUPM_REVISION=main" >> $GITHUB_ENV | |
elif [[ '${{ github.ref }}' == 'refs/heads/nightly' ]]; then | |
echo "NU_VERSION=nightly" >> $GITHUB_ENV | |
echo "NUPM_REVISION=main" >> $GITHUB_ENV | |
else | |
echo "NU_VERSION=${{ inputs.nu_version }}" >> $GITHUB_ENV | |
echo "NUPM_REVISION=${{ inputs.nupm_revision }}" >> $GITHUB_ENV | |
fi | |
- name: Setup nushell and nupm | |
uses: amtoine/[email protected] | |
id: "nu-setup" | |
with: | |
nu_version: ${{ env.NU_VERSION }} | |
nupm_revision: ${{ env.NUPM_REVISION }} | |
- name: Set up Git | |
shell: bash | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global init.defaultBranch main | |
- name: Run the tests | |
run: | | |
# NOTE: required for `use nupm` to work inside `toolkit test` | |
"$env.NU_LIB_DIRS = [ (${{ steps.nu-setup.outputs.nupm_path }} | path dirname) ]" | |
| save --force /tmp/env.nu | |
# NOTE: required for `use toolkit.nu` to work | |
nu --env-config /tmp/env.nu --commands " | |
use toolkit.nu | |
toolkit test --verbose | |
" |