static: add CDC logo #89
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: Run basic checks | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
pull_request: | |
branches: | |
- dev | |
- main | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
env: | |
TELESCOOP_DEV: true | |
IS_TESTING: true | |
jobs: | |
setup: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
# https://github.com/actions/setup-python/blob/main/README.md#caching-packages-dependencies | |
- run: pip install -r back/requirements.txt | |
- name: Install front js dependencies | |
run: npm install | |
working-directory: ./front | |
- name: Cache Node.js dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ./front/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | |
pre-commit: | |
runs-on: ubuntu-22.04 | |
needs: setup | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
# https://github.com/actions/setup-python/blob/main/README.md#caching-packages-dependencies | |
- run: pip install -r back/requirements.txt | |
- name: Set up PostGIS | |
uses: nyurik/action-setup-postgis@v2 | |
with: | |
username: myuser | |
password: securepassword | |
database: mydatabase | |
port: 5432 | |
id: postgres | |
- name: Create local_settings.ini | |
run: | | |
cat <<EOF > back/local_settings.ini | |
[database] | |
engine=postgresql | |
user=myuser | |
name=mydatabase | |
password=securepassword | |
EOF | |
- name: Restore Node.js cache | |
uses: actions/cache@v3 | |
with: | |
path: ./front/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | |
- name: Install js dependencies if not cached | |
if: steps.cache-node.outputs.cache-hit != 'true' | |
run: npm install | |
working-directory: ./front | |
- name: Enforce pre-commit hook server side | |
env: | |
DATABASE_URL: "postgres://myuser:securepassword@localhost:5432/mydatabase" | |
PGSERVICE: ${{ steps.postgres.outputs.service-name }} | |
uses: pre-commit/[email protected] | |
node-setup: | |
runs-on: ubuntu-22.04 | |
needs: setup | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ./front/.nvmrc | |
cache: "npm" | |
- name: Restore Node.js cache | |
uses: actions/cache@v3 | |
with: | |
path: ./front/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | |
- name: Install js dependencies if not cached | |
if: steps.cache-node.outputs.cache-hit != 'true' | |
run: npm install | |
working-directory: ./front | |
frontend-tests: | |
runs-on: ubuntu-22.04 | |
needs: [setup, node-setup] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ./front/.nvmrc | |
cache: "npm" | |
- name: Restore Node.js cache | |
uses: actions/cache@v3 | |
with: | |
path: ./front/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | |
- name: Install front js dependencies if not cached | |
if: steps.cache-node.outputs.cache-hit != 'true' | |
run: npm install | |
working-directory: ./front | |
- name: Run vitest | |
run: npm run test | |
working-directory: ./front | |
- name: Run cypress component tests | |
uses: cypress-io/github-action@v6 | |
with: | |
component: true | |
working-directory: ./front | |
e2e-tests: | |
runs-on: ubuntu-22.04 | |
needs: setup | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- run: pip install -r back/requirements.txt | |
- name: Set up PostGIS | |
uses: nyurik/action-setup-postgis@v2 | |
with: | |
username: myuser | |
password: securepassword | |
database: mydatabase | |
port: 5432 | |
id: postgres | |
- name: Create local_settings.ini | |
run: | | |
cat <<EOF > back/local_settings.ini | |
[database] | |
engine=postgresql | |
user=myuser | |
name=mydatabase | |
password=securepassword | |
EOF | |
- name: Migrate database | |
run: python manage.py migrate | |
working-directory: ./back | |
- name: Run back-end server in background | |
run: python manage.py runserver localhost:8000 & | |
working-directory: ./back | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ./front/.nvmrc | |
cache: "npm" | |
- name: Restore Node.js cache from node-setup | |
uses: actions/cache@v3 | |
with: | |
path: ./front/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('front/package-lock.json') }} | |
- name: Install front js dependencies if not cached | |
if: steps.cache-node.outputs.cache-hit != 'true' | |
run: npm install | |
working-directory: ./front | |
- name: Build front | |
run: npm run build | |
working-directory: "./front" | |
- name: Run e2e tests | |
uses: cypress-io/github-action@v6 | |
with: | |
start: npm run preview | |
browser: chrome | |
config-file: cypress.config.ts | |
working-directory: ./front | |
- name: Upload cypress screenshots | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshot | |
path: | | |
front/cypress/screenshots | |
retention-days: 10 | |
doc-tests: | |
runs-on: ubuntu-22.04 | |
needs: [setup] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python doc | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
- run: pip install -r mkdocs-requirements.txt | |
- name: Run documentation validation | |
run: mkdocs build --strict |