Shell Testing #48
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-12 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install os dependencies | |
run: | | |
if [ "${{ runner.os }}" = "Linux" ]; then | |
sudo apt update && sudo apt install attr kcov | |
else | |
brew install kcov diffutils grep | |
fi | |
- 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 | |
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 | |
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-12 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install os dependencies | |
run: | | |
if [ "${{ runner.os }}" = "Linux" ]; then | |
sudo apt update && sudo apt install wget curl | |
else | |
brew install wget curl | |
fi | |
- 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 | |
- 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 | |
- name: Install from source | |
run: | | |
sudo make install | |
dropboxignore version | |
- name: Uninstall | |
run: sudo make uninstall |