Skip to content

Commit

Permalink
Merge pull request #142 from vintasoftware/feat/tox
Browse files Browse the repository at this point in the history
Add `tox`
  • Loading branch information
pamella authored Jun 28, 2024
2 parents d681b53 + 73f5c8d commit dac9fbf
Show file tree
Hide file tree
Showing 5 changed files with 244 additions and 26 deletions.
57 changes: 37 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ name: CI

on: [push, pull_request]

env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: "github-actions"

jobs:
build-django:
name: Django CI
name: Django CI (Python ${{ matrix.python-version }})

runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
Expand All @@ -33,26 +33,28 @@ jobs:
- name: Run tests
run: |
poetry run coverage run -m pytest
poetry run coveralls
poetry run tox
env:
OPENAI_API_KEY: "sk-fake-test-key-123"

- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: django-coverage
allow-empty: true
run: |
poetry run coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: "github-actions"
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_FLAG_NAME: django-coverage-${{ matrix.python-version }}
COVERALLS_PARALLEL: true

build-frontend:
name: Frontend CI
runs-on: ubuntu-latest
# Wait for Django to finish before starting due to Coveralls parallel
# Source: https://docs.coveralls.io/parallel-builds
needs: build-django

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -82,6 +84,12 @@ jobs:
working-directory: ./frontend
run: |
pnpm run coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: "github-actions"
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_FLAG_NAME: node-coverage
COVERALLS_PARALLEL: true

- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
Expand All @@ -90,16 +98,25 @@ jobs:
parallel: true
flag-name: node-coverage
allow-empty: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: "github-actions"
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_FLAG_NAME: node-coverage
COVERALLS_PARALLEL: true

finish:
coveralls:
name: Coveralls

# Wait for Django and Frontend to finish before starting due to Coveralls parallel
needs: [build-django, build-frontend]
if: ${{ always() }}

runs-on: ubuntu-latest

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
carryforward: "django-coverage,node-coverage"
carryforward: "django-coverage-3.10,django-coverage-3.11,django-coverage-3.12,node-coverage"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ __pycache__/
.coverage
*/coverage/

# tox
.tox/

# pycharm
.idea/

Expand Down
Loading

0 comments on commit dac9fbf

Please sign in to comment.