diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..0c85d0e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,55 @@ +# this workflow runs unit tests and checks code style +# for different versions of python on different operating systems + +name: tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + tests: + runs-on: ${{ matrix.config.os }} + name: ${{ matrix.config.os }} (${{ matrix.config.py }}) + strategy: + fail-fast: false + matrix: + config: + - { os: ubuntu-latest, py: "3.12" } + - { os: ubuntu-latest, py: "3.11" } + - { os: windows-latest, py: "3.10" } + - { os: macOS-latest, py: "3.10" } + - { os: ubuntu-latest, py: "3.10" } + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.config.py }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.config.py }} + + - name: Install poetry + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Install package + run: poetry install + + - name: Test with pytest + run: poetry run pytest tests/ --cov=bblocks_data_importers --cov-report=xml + + - name: Use Codecov to track coverage + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml # coverage report + fail_ci_if_error: true + verbose: true + + - name: Check code style + run: poetry run black src tests --check \ No newline at end of file