CI: install Nushell from latest nightly build #31
Workflow file for this run
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
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
name: continuous-integration | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
tests: | |
strategy: | |
fail-fast: true | |
matrix: | |
platform: [windows-latest, macos-latest, ubuntu-20.04] | |
runs-on: ${{ matrix.platform }} | |
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 | |
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 | |
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 | |
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 }}" | |
- name: Show Nushell Version | |
run: | | |
"$HOME/${{ env.NU_BIN }}" --commands "version" | |
- name: Run the tests | |
run: | | |
pwd | |
ls $PWD | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
"$HOME/${{ env.NU_BIN }}" --commands "use $(echo $PWD | tr '/' '\\' | sed 's/^\\d\\/d:\\/')/nupm/; nupm test" | |
else | |
"$HOME/${{ env.NU_BIN }}" --commands "use $PWD/nupm/; nupm test" | |
fi |