Use docker for testing #176
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: | |
pull_request: | |
branches: [ master ] | |
paths: | |
- '**.sh' | |
- '**.bats' | |
- '.github/workflows/testing.yml' | |
env: | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
jobs: | |
checkout-code: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- uses: pre-commit/[email protected] | |
- uses: pre-commit-ci/[email protected] | |
if: always() | |
unit: | |
needs: [checkout-code] | |
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-get -qq update && sudo apt-get -qq install attr kcov | |
- name: Install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install --quite 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 /opt/bats-assert | |
git clone https://github.com/bats-core/bats-support.git /opt/bats-support | |
git clone https://github.com/bats-core/bats-file.git /opt/bats-file | |
- name: Run bats tests | |
run: make test-ci | |
- 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@v3 | |
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-get update -qq && sudo apt-get install -qq wget curl | |
- name: Install macOS dependencies | |
if: runner.os == 'macOS' | |
run: brew install --quite 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 |