diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f9ae651 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,94 @@ +name: Continuous integration + +on: + push: + branches: + - master + - develop + pull_request: + branches: + - master + - develop + +jobs: + unit-tests: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - uses: abatilo/actions-poetry@v2 + + - name: Setup virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + + - uses: actions/cache@v3 + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }}-${{ matrix.os }} + + - name: Install dependencies + run: poetry install --no-ansi + + - name: Tests + run: poetry run pytest --cov-report term + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + static-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - uses: abatilo/actions-poetry@v2 + + - name: Setup virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + + - uses: actions/cache@v3 + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }}-${{ matrix.os }} + + - name: Install dependencies + run: poetry install --no-ansi + + - name: Mypycode style + run: poetry run mypy . --check + + - name: Black code style + run: poetry run black . --check + + - name: Flake8 code style + run: poetry run flake8 + + - name: Isort code style + run: poetry run isort . --check