asdf/.github/workflows/tests.yml
2021-05-26 23:11:02 +10:00

97 lines
2.4 KiB
YAML

name: Tests
on:
push:
branches:
- master
pull_request:
env:
BATS_VERSION: v1.3.0
jobs:
wsl1:
if: github.ref != 'refs/heads/master'
strategy:
fail-fast: false
matrix:
os:
- windows-2019
distribution:
- Ubuntu-20.04
- Ubuntu-18.04
# - Alpine
# - Debian
# - kali-linux
# - openSUSE-Leap-15.2
runs-on: ${{ matrix.os }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup WSL & install test dependencies
uses: Vampire/setup-wsl@v1
with:
distribution: ${{ matrix.distribution }}
additional-packages: curl git fish
- name: Install bats
shell: wsl-bash {0}
run: |
git clone --depth 1 --branch "${{ env.BATS_VERSION }}" https://github.com/bats-core/bats-core.git $HOME/bats-core
cd $HOME/bats-core
./install.sh $HOME
$HOME/bin/bats --version
- name: Run tests
shell: wsl-bash {0}
run: |
$HOME/bin/bats test
env:
GITHUB_API_TOKEN: ${{ github.token }}
nix:
strategy:
fail-fast: false
matrix:
os:
- macos-10.15
# - macos-11 - enable once out of private preview: https://github.com/actions/virtual-environments#available-environments
- ubuntu-18.04
- ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install test dependencies
if: runner.os == 'macos'
run: brew install coreutils fish
- name: Install test dependencies
if: runner.os == 'linux'
run: |
PPA="ppa:fish-shell/nightly-master"
sudo add-apt-repository -y "$PPA"
sudo apt-get update
sudo apt-get -y install fish
- name: Install bats
run: |
git clone --depth 1 --branch "${{ env.BATS_VERSION }}" 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 }}