Fix jobs not running on all OS's #27
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: Tests | |
on: | |
push: | |
branches: ['*'] | |
pull_request: | |
jobs: | |
build-and-test: | |
name: Test on ${{ matrix.platform }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.10', '3.11'] | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set pip cache directory | |
id: pip-cache | |
run: | | |
if [[ $RUNNER_OS == 'Windows' ]]; then | |
echo "dir=C:\\Users\\runneradmin\\AppData\\Local\\pip\\Cache" >> $GITHUB_OUTPUT | |
else | |
echo "dir=~/.cache/pip" >> $GITHUB_OUTPUT | |
fi | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | |
restore-keys: ${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install .[dev] | |
- name: Type check with mypy | |
run: mypy tofea | |
- name: Test with pytest | |
run: pytest --cov tofea | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |