bump version to 1.2.0 #54
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: Test | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
# Replace pull_request with pull_request_target if you | |
# plan to use this action with forks, see the Limitations section | |
pull_request: | |
branches: | |
- main | |
env: # environment variables (available in any part of the action) | |
NODE_VERSION: 21 | |
PYTHON_VERSION: 3.12 | |
MONGODB_VERSION: 8.0 | |
jobs: | |
run-js-linters: | |
name: Run JS linters | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: "npm" | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Run eslint | |
run: npm run lint | |
run-python-linters: | |
name: Run Python linters | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Run black | |
uses: psf/black@stable | |
with: | |
options: "--config backend/pyproject.toml" | |
test-backend: | |
name: Run backend unit tests | |
runs-on: ubuntu-latest | |
needs: run-python-linters | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: "poetry" | |
- name: Start MongoDB | |
uses: supercharge/[email protected] | |
with: | |
mongodb-version: ${{ env.MONGODB_VERSION }} | |
# Install dependencies. `--no-root` means "install all dependencies but not the project | |
# itself", which is what you want to avoid caching _your_ code. The `if` statement | |
# ensures this only runs on a cache miss. | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-root --with dev | |
- name: Test with pytest | |
run: poetry run pytest --cov=app tests --cov-report html | |
# upload-artifact action does not take into account working-directory default | |
# see https://github.com/actions/upload-artifact/issues/232 | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage-report | |
path: backend/htmlcov | |
test-frontend: | |
name: Run frontend unit tests | |
runs-on: ubuntu-latest | |
needs: run-js-linters | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm run test |