Reduce local variable usage #460
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: CI | |
on: [push] | |
jobs: | |
backend: | |
strategy: | |
fail-fast: false | |
matrix: | |
command: | |
- "ruff check ." | |
- "ruff format --check ws" | |
- "mypy ws" | |
- "pylint --jobs=0 ws" | |
- "pytest" | |
runs-on: ubuntu-22.04 | |
services: | |
# TODO: Only the `test` step in the matrix needs this service up and running. | |
# All others have no need to hit the database. | |
postgres: | |
image: postgres:13.1 # Reflects version running in RDS | |
env: | |
POSTGRES_USER: ws | |
POSTGRES_PASSWORD: password | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 3 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: "Clone repo" | |
uses: actions/checkout@v2 | |
- name: "Install buildx" | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: "Restore Docker cache" | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-ws-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-ws-buildx- | |
- name: "Build CI container" | |
run: | | |
docker buildx build \ | |
--cache-from "type=local,src=/tmp/.buildx-cache" \ | |
--cache-to "type=local,dest=/tmp/.buildx-cache" \ | |
--load \ | |
--tag ws \ | |
--target build \ | |
. | |
- name: ${{ matrix.command }} | |
env: | |
WS_DJANGO_TEST: "1" | |
DB_HOST: "localhost" | |
DB_PASSWORD: "password" | |
run: | | |
docker run \ | |
--network host \ | |
--env WS_DJANGO_TEST \ | |
--env DB_HOST \ | |
--env DB_PASSWORD \ | |
--rm ws \ | |
${{ matrix.command }} | |
frontend: | |
strategy: | |
fail-fast: false | |
matrix: | |
command: | |
- "npm run lint" | |
# TODO: Actually upload this to codecov | |
- "npm run test:unit -- --coverage" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Clone repo" | |
uses: actions/checkout@v2 | |
- name: "Install buildx" | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: "Restore Docker cache" | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-frontend-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-frontend-buildx- | |
- name: "Build CI container" | |
run: | | |
docker buildx build \ | |
--cache-from "type=local,src=/tmp/.buildx-cache" \ | |
--cache-to "type=local,dest=/tmp/.buildx-cache" \ | |
--load \ | |
--tag frontend \ | |
--target build \ | |
frontend | |
- name: ${{ matrix.command }} | |
run: | | |
docker run \ | |
--rm frontend \ | |
${{ matrix.command }} |