Merge pull request #71 from CambioML/seis-dev #240
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: Python application | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
max-parallel: 1 # Ensures the tests run sequentially | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
pip install black | |
pip install isort | |
python -m pip install poetry | |
poetry install --no-root # This will install the project dependencies defined in pyproject.toml | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. | |
flake8 . --count --exit-zero --max-complexity=10 --statistics | |
- name: Format code with Black | |
run: | | |
black . --exclude="" --check --verbose | |
- name: Sort imports with isort | |
run: | | |
isort . --profile=black --check-only --verbose | |
- name: Test with unittest | |
env: | |
CAMBIO_API_KEY: ${{ secrets.CAMBIO_API_KEY }} | |
run: | | |
poetry run python -m unittest discover -v tests |