Simplify and consolidate unit test suites for context and git-context #9
This file contains hidden or 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: Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: # Allow manual triggering | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for git-related tests | |
- name: Set up environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y bc | |
- name: Make scripts executable | |
run: | | |
chmod +x context | |
chmod +x test/test_runner.sh | |
chmod +x test/unit/test_*.sh | |
- name: Run tests | |
run: | | |
./test/test_runner.sh | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Shell script linting | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y shellcheck | |
shellcheck context | |
shellcheck test/test_runner.sh | |
shellcheck test/test_utils.sh | |
shellcheck test/unit/test_*.sh | |
compatibility: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Make scripts executable | |
run: | | |
chmod +x context | |
chmod +x test/test_runner.sh | |
chmod +x test/unit/test_*.sh | |
- name: Run tests on ${{ matrix.os }} | |
run: | | |
./test/test_runner.sh |