fix: split push notification #11210
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: Tests | |
on: [push] | |
jobs: | |
js-tests: | |
name: Frontend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "21" | |
cache: "npm" | |
- name: Install node dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm run test:ci | |
python-linting: | |
name: Black | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install build dependencies | |
run: python -m pip install black==24.4.2 | |
- name: Run black | |
run: python -m black --check . | |
docker-build: | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
file: .github/Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ghcr.io/lafranceinsoumise/actionpopulaire.fr/agir-test-image:latest | |
python-tests: | |
name: Django | |
needs: docker-build | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/lafranceinsoumise/actionpopulaire.fr/agir-test-image:latest | |
credentials: | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
services: | |
postgres: | |
image: postgis/postgis | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
DATABASE_URL: "postgis://postgres:postgres@postgres:5432/postgres" | |
LOG_DISABLE_JOURNALD: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup backend dependency cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry | |
key: poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} | |
restore-keys: | | |
poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('.github/workflows/*.yml') }} | |
poetry-${{ hashFiles('**/poetry.lock') }} | |
poetry- | |
- name: Install backend dependencies | |
run: poetry install --sync --no-interaction | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "21" | |
cache: "npm" | |
- name: Install frontend dependencies | |
run: npm ci | |
- name: Build frontend bundle | |
run: npm run build:dev | |
- name: Run backend tests | |
run: poetry run coverage run ./manage.py test -v 2 | |
- name: Report backend coverage | |
run: | | |
poetry run coverage report | |
poetry run coverage json | |
echo "::notice title=Coverage::Coverage $(jq .totals.percent_covered < coverage.json) %" |