Nour/email verification #2194
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| CACHE_NUMBER: 1 | |
| jobs: | |
| frontend-readiness: | |
| name: Frontend linting / readiness checks | |
| # Defines the type of runner the job runs on | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout to the repository | |
| uses: actions/checkout@v3 | |
| - name: Cache conda | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/conda_pkgs_dir | |
| key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-dev.yml') }} | |
| - name: Setup miniconda | |
| uses: conda-incubator/[email protected] | |
| with: | |
| environment-file: environment-dev.yml | |
| activate-environment: galaxy | |
| use-only-tar-bz2: true | |
| - name: Set up NodeJS environment | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20.12.2' | |
| # Consider this as an add on to optimize the execution of actions | |
| - name: Cache node modules | |
| id: cache-npm | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ~/.npm | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| ${{ runner.os }}- | |
| - name: Install package dependencies | |
| run: npm ci | |
| working-directory: ./frontend | |
| - name: Check linting and formatting | |
| # Custom script for checking the linting and formatting being in place | |
| run: npm run lint | |
| working-directory: ./frontend | |
| - name: Check TypeScript types | |
| run: npx tsc --noEmit | |
| working-directory: ./frontend | |
| - name: Verify generated types are up-to-date | |
| run: | | |
| # Run the type generation script (conda environment 'galaxy' is already activated) | |
| ./generate_types.sh | |
| # Check if any files were modified | |
| git diff --exit-code src/api/_autogen/ || (echo "ERROR: Generated TypeScript types are out of date. Please run ./generate_types.sh and commit the changes." && exit 1) | |
| working-directory: ./frontend | |
| lint: | |
| name: Linter (pre-commit) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout branch | |
| uses: actions/[email protected] | |
| - name: Cache conda | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/conda_pkgs_dir | |
| key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-dev.yml') }} | |
| - name: Setup miniconda | |
| uses: conda-incubator/[email protected] | |
| with: | |
| environment-file: environment-dev.yml | |
| activate-environment: galaxy | |
| use-only-tar-bz2: true | |
| - name: Set up NodeJS environment | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20.12.2' | |
| - name: Cache node modules | |
| id: cache-npm | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-node-modules | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ~/.npm | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| ${{ runner.os }}- | |
| - name: Install frontend dependencies for pre-commit | |
| run: npm ci | |
| working-directory: ./frontend | |
| - name: Run linter | |
| run: | | |
| pre-commit install | |
| pre-commit run -a | |
| unit-test-backend: | |
| name: Backend unit tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout branch | |
| uses: actions/[email protected] | |
| - name: Cache conda | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/conda_pkgs_dir | |
| key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-dev.yml') }} | |
| - name: Setup miniconda | |
| uses: conda-incubator/[email protected] | |
| with: | |
| environment-file: environment-dev.yml | |
| activate-environment: galaxy | |
| use-only-tar-bz2: true | |
| - name: Initialize migrations | |
| run: ./manage.py makemigrations | |
| working-directory: ./backend | |
| - name: Run tests | |
| run: find * -type f -name "test*.py" | sed "s/\.py$//g" | sed "s/\//./g" | xargs coverage run --branch --source='.' ./manage.py test -v=2 | |
| working-directory: ./backend | |
| - name: Report coverage | |
| run: coverage report | |
| working-directory: ./backend |