Migrate CI from Travis to GitHub Actions #1
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] | |
| jobs: | |
| style: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install style tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black flake8 pep8-naming | |
| - name: black | |
| run: black --diff --check . | |
| - name: flake8 | |
| run: flake8 | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt coverage | |
| pip install -e . | |
| - name: Run tests | |
| run: PYTHONPATH=. coverage run $(which pytest) | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| flags: py${{ matrix.python-version }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| env: | |
| OS: ${{ runner.os }} | |
| PYTHON: ${{ matrix.python-version }} |