Skip to content

Commit

Permalink
use the latest stable version of Nushell in the CI (#37)
Browse files Browse the repository at this point in the history
might supersede:
- #36

related to
- hustcer/setup-nu#58

## description
this is an experiment to see if that could work without pulling Nightly.
there is an [open issue in the GitHub
action](hustcer/setup-nu#58) for that 👍
  • Loading branch information
amtoine authored Oct 30, 2023
1 parent 58b9217 commit b361bf4
Showing 1 changed file with 8 additions and 45 deletions.
53 changes: 8 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: continuous-integration

defaults:
run:
shell: bash
shell: nu {0}

env:
NU_LOG_LEVEL: DEBUG
Expand All @@ -26,54 +26,17 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set platform-specific variables
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
echo "ARCH=x86_64-linux-gnu-full" >> $GITHUB_ENV
echo "EXT=tar.gz" >> $GITHUB_ENV
echo "NU_BIN=nu" >> $GITHUB_ENV
echo "NUPM=$HOME/nupm" >> $GITHUB_ENV
elif [ "${{ runner.os }}" = "Windows" ]; then
echo "ARCH=x86_64-pc-windows-msvc" >> $GITHUB_ENV
echo "EXT=zip" >> $GITHUB_ENV
echo "NU_BIN=nu.exe" >> $GITHUB_ENV
# NOTE: for some reason, `$HOME` gives an incorrect path on Windows, e.g. it looks like
# `/c/Users/runneradmin` where it should really be `c:\Users\runneradmin`: this commands
# changes the `/` into `\` and replaces the first part of the path with "x:\"
echo "NUPM=$(echo $HOME | tr '/' '\\' | sed 's/^\\\(.\)\\/\1:\\/')/nupm" >> $GITHUB_ENV
elif [ "${{ runner.os }}" = "macOS" ]; then
echo "ARCH=x86_64-apple-darwin" >> $GITHUB_ENV
echo "EXT=tar.gz" >> $GITHUB_ENV
echo "NU_BIN=nu" >> $GITHUB_ENV
echo "NUPM=$HOME/nupm" >> $GITHUB_ENV
fi
- name: Install Nushell from Nightly
run: |
tarball=$(\
curl -L https://api.github.com/repos/nushell/nightly/releases \
| jq 'sort_by(.published_at) | reverse | .[0].assets'\
| jq '.[] | select(.name | test("${{ env.ARCH }}.${{ env.EXT }}")) | {name, browser_download_url}'\
)
name=$(echo $tarball | jq '.name' | tr -d '"' | sed 's/.${{ env.EXT }}$//')
url=$(echo $tarball | jq '.browser_download_url' | tr -d '"')
curl -fLo $name $url
if [ "${{ env.EXT }}" = "tar.gz" ]; then
tar xvf $name --directory /tmp
elif [ "${{ env.EXT }}" = "zip" ]; then
unzip $name -d "/tmp/$name"
fi
cp "/tmp/$name/${{ env.NU_BIN }}" "$HOME/${{ env.NU_BIN }}"
- uses: hustcer/[email protected]
with:
version: '0.86'

- name: Install Nupm from Source
run: git clone https://github.com/nushell/nupm "${{ env.NUPM }}"
run: git clone https://github.com/nushell/nupm ~/nupm/

- name: Show Nushell Version
run: |
"$HOME/${{ env.NU_BIN }}" --commands "version"
run: version

- name: Run the tests
run: |
"$HOME/${{ env.NU_BIN }}" --commands "use ${{ env.NUPM }}/nupm/; nupm test"
use ~/nupm/nupm/
nupm test

0 comments on commit b361bf4

Please sign in to comment.