diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..a12971f --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,14 @@ +name: on push to main + +on: + push: + branches: + - main + +concurrency: + group: main + cancel-in-progress: true + +jobs: + unit_tests: + uses: ./.github/workflows/tox.yaml diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..f2b8638 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,21 @@ +name: on pull request + +on: + pull_request: + types: + - opened + - synchronize + - ready_for_review + - edited + - reopened + branches: + - main + +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + +jobs: + # Run the unit tests on every PR, even from external repos + unit_tests: + uses: ./.github/workflows/tox.yaml diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml new file mode 100644 index 0000000..e6d2fb7 --- /dev/null +++ b/.github/workflows/tox.yaml @@ -0,0 +1,37 @@ +name: Tox unit tests + +on: + workflow_call: + +jobs: + build: + name: Tox unit tests and linting + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10'] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox + + - name: Test with tox + run: tox + + - name: Generate coverage reports + run: tox -e cover + + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + with: + name: code-coverage-report + path: cover/