Shell Testing #54
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
name: Shell Testing | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'src/**.sh' | |
- 'tests/*.bats' | |
- '.github/workflows/shell-testing.yml' | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'src/**.sh' | |
- 'tests/*.bats' | |
- '.github/workflows/shell-testing.yml' | |
workflow_run: | |
workflows: | |
- 'Shellcheck' | |
types: | |
- completed | |
env: | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
jobs: | |
unit: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-22.04, macos-13 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: sudo apt update && sudo apt install attr kcov | |
- name: Install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install kcov diffutils grep coreutils | |
- name: Install bats-core | |
run: | | |
git clone https://github.com/bats-core/bats-core.git | |
cd bats-core | |
sudo ./install.sh /usr/local | |
- name: Install bats extras | |
run: | | |
git clone https://github.com/bats-core/bats-assert.git libs/bats-assert | |
git clone https://github.com/bats-core/bats-support.git libs/bats-support | |
git clone https://github.com/bats-core/bats-file.git libs/bats-file | |
- name: Run bats tests | |
run: make shell-tests | |
- name: Coverage report | |
if: runner.os == 'Linux' | |
run: | | |
kcov --include-path=src /tmp/coverage bats tests/*.bats | |
cp $(find /tmp/coverage -type f -name 'cobertura.xml') coverage.xml | |
- uses: codecov/codecov-action@v2 | |
if: runner.os == 'Linux' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
integration: | |
needs: [unit] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-22.04, macos-13 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: sudo apt update && sudo apt install wget curl | |
- name: Install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install wget curl | |
- name: Install using wget | |
run: | | |
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/src/utils/install.sh)" | |
dropboxignore version | |
sudo rm /usr/local/bin/dropboxignore | |
sudo rm -rf /usr/local/lib/dropboxignore | |
- name: Install using curl | |
run: | | |
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/src/utils/install.sh)" | |
dropboxignore version | |
sudo rm /usr/local/bin/dropboxignore | |
sudo rm -rf /usr/local/lib/dropboxignore | |
- name: Install from source | |
run: | | |
sudo make install | |
dropboxignore version | |
- name: Uninstall | |
run: sudo make uninstall |