hosts/.github/workflows/tests.yml

85 lines
1.9 KiB
YAML

###############################################################################
# .github/workflows/tests.yml
#
# NOTE: GitHub Actions does not allocate a TTY, preventing detection of
# piped input using `[[ -t 0 ]]`.
#
# More information:
#
# https://github.com/actions/runner/issues/241
#
# faketty is a GitHub action that uses work-arounds to provide a tty:
#
# https://github.com/marketplace/actions/faketty
#
# Scripts used by faketty for each platform:
#
# linux: `faketty`
#
# ```bash
# #!/bin/bash
#
# script -q -e -c "$*"
# ```
#
# win32: `faketty.ps1`
#
# ```posh
# Invoke-Expression "$args"
# ```
#
# darwin: `faketty`
#
# requires: `brew install expect`
#
# ```bash
# #!/bin/bash
#
# unbuffer $*
# ```
###############################################################################
name: "hosts · Test Suite"
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
workflow_dispatch:
jobs:
test-macos-11:
name: "Test: macOS Big Sur 11.0"
runs-on: macos-11.0
steps:
- uses: actions/checkout@v3
- name: "Setup"
run: |
brew update
brew install bats-core
brew install expect
- name: "Set $TERM=xterm"
run: printf "TERM=xterm\\n" >> $GITHUB_ENV
- name: "Run bats tests"
run: unbuffer bats test
test-ubuntu-latest:
name: "Test: Ubuntu Latest"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Setup"
run: |
sudo apt-get update
sudo apt-get install bats -y
- name: "Install bats-core"
run: |
git clone https://github.com/bats-core/bats-core.git "${HOME}/bats-core" &&
cd "${HOME}/bats-core"
git checkout 2e2e5df6adf0b846b411b6b2f7bb654cbc3e2c4e
sudo ./install.sh /usr/local
- name: "Set $TERM=xterm"
run: printf "TERM=xterm\\n" >> $GITHUB_ENV
- name: "Run bats tests"
run: script -q -e -c "bats test"