asdf/.github/workflows/tests.yml
2023-01-06 07:19:10 -05:00

70 lines
2.2 KiB
YAML

name: Tests
on:
push:
branches:
- master
pull_request:
env:
ELVISH_VERSION: v0.18.0
NUSHELL_VERSION: 0.73.0
jobs:
nix:
strategy:
fail-fast: false
matrix:
os:
- macos-10.15
- macos-11
- macos-12
- ubuntu-20.04
- ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install test dependencies
if: runner.os == 'macos'
run: brew install coreutils fish elvish nushell
- name: Install test dependencies
if: runner.os == 'linux'
run: |
sudo add-apt-repository -y ppa:fish-shell/nightly-master
sudo apt-get update
sudo apt-get -y install fish curl
# Create $HOME/bin
mkdir -p "$HOME/bin"
# Download elvish binary and add to path
curl https://dl.elv.sh/linux-amd64/elvish-${{ env.ELVISH_VERSION }}.tar.gz -o elvish-${{ env.ELVISH_VERSION }}.tar.gz
tar xzf elvish-${{ env.ELVISH_VERSION }}.tar.gz
rm elvish-${{ env.ELVISH_VERSION }}.tar.gz
mv elvish-${{ env.ELVISH_VERSION }} "$HOME/bin/elvish"
# Download nushell binary and add to path
curl -L https://github.com/nushell/nushell/releases/download/${{ env.NUSHELL_VERSION }}/nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz -o nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
tar xzf nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
rm nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
mv nu-${{ env.NUSHELL_VERSION }}-x86_64-unknown-linux-gnu/* "$HOME/bin"
# Add $HOME/bin to path
echo "$HOME/bin" >>"$GITHUB_PATH"
- name: Install bats
run: |
git clone --depth 1 --branch "v$(grep -Eo "^\\s*bats\\s*.*$" ".tool-versions" | cut -d ' ' -f2-)" https://github.com/bats-core/bats-core.git $HOME/bats-core
echo "$HOME/bats-core/bin" >>"$GITHUB_PATH"
- name: Run tests
run: bats test
env:
GITHUB_API_TOKEN: ${{ github.token }}
SKIP_NUSHELL_TESTS: "${{ matrix.os == 'ubuntu-18.04' && 'YES' }}"