mirror of
https://github.com/suitenumerique/docs.git
synced 2026-05-15 03:16:58 +02:00
Most recent external contributions (including my own!) stumble on the changelog. IMHO, this represents an unnecessary friction for new contributors and a loss of focus for the reviewing team. I propose that we put the release manager in charge of maintaining the CHANGELOG.md file at each release, based on the commits being included in that specific release. To view unreleased changes, everyone can just browse the latest commit history.
160 lines
4.9 KiB
YAML
160 lines
4.9 KiB
YAML
name: Main Workflow
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
|
|
jobs:
|
|
install-dependencies:
|
|
uses: ./.github/workflows/dependencies.yml
|
|
with:
|
|
with-build_mails: true
|
|
|
|
lint-git:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request' # Makes sense only for pull requests
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: show
|
|
run: git log
|
|
- name: Enforce absence of print statements in code
|
|
run: |
|
|
! git diff origin/${{ github.event.pull_request.base.ref }}..HEAD -- . ':(exclude)**/impress.yml' | grep "print("
|
|
- name: Check absence of fixup commits
|
|
run: |
|
|
! git log | grep 'fixup!'
|
|
- name: Install gitlint
|
|
run: pip install --user requests gitlint
|
|
- name: Lint commit messages added to main
|
|
run: ~/.local/bin/gitlint --commits origin/${{ github.event.pull_request.base.ref }}..HEAD
|
|
|
|
lint-back:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src/backend
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Install Python
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: "3.12.6"
|
|
- name: Upgrade pip and setuptools
|
|
run: pip install --upgrade pip setuptools
|
|
- name: Install development dependencies
|
|
run: pip install --user .[dev]
|
|
- name: Check code formatting with ruff
|
|
run: ~/.local/bin/ruff format . --diff
|
|
- name: Lint code with ruff
|
|
run: ~/.local/bin/ruff check .
|
|
- name: Lint code with pylint
|
|
run: ~/.local/bin/pylint .
|
|
|
|
test-back:
|
|
runs-on: ubuntu-latest
|
|
needs: install-dependencies
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: src/backend
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_DB: impress
|
|
POSTGRES_USER: dinum
|
|
POSTGRES_PASSWORD: pass
|
|
ports:
|
|
- 5432:5432
|
|
# needed because the postgres container does not provide a healthcheck
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
env:
|
|
DJANGO_CONFIGURATION: Test
|
|
DJANGO_SETTINGS_MODULE: impress.settings
|
|
DJANGO_SECRET_KEY: ThisIsAnExampleKeyForTestPurposeOnly
|
|
OIDC_OP_JWKS_ENDPOINT: /endpoint-for-test-purpose-only
|
|
DB_HOST: localhost
|
|
DB_NAME: impress
|
|
DB_USER: dinum
|
|
DB_PASSWORD: pass
|
|
DB_PORT: 5432
|
|
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
|
|
AWS_S3_ENDPOINT_URL: http://localhost:9000
|
|
AWS_S3_ACCESS_KEY_ID: impress
|
|
AWS_S3_SECRET_ACCESS_KEY: password
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Create writable /data
|
|
run: |
|
|
sudo mkdir -p /data/media && \
|
|
sudo mkdir -p /data/static
|
|
|
|
- name: Restore the mail templates
|
|
uses: actions/cache@v4
|
|
id: mail-templates
|
|
with:
|
|
path: "src/backend/core/templates/mail"
|
|
key: mail-templates-${{ hashFiles('src/mail/mjml') }}
|
|
fail-on-cache-miss: true
|
|
|
|
- name: Start MinIO
|
|
run: |
|
|
docker pull minio/minio
|
|
docker run -d --name minio \
|
|
-p 9000:9000 \
|
|
-e "MINIO_ACCESS_KEY=impress" \
|
|
-e "MINIO_SECRET_KEY=password" \
|
|
-v /data/media:/data \
|
|
minio/minio server --console-address :9001 /data
|
|
|
|
# Tool to wait for a service to be ready
|
|
- name: Install Dockerize
|
|
run: |
|
|
curl -sSL https://github.com/jwilder/dockerize/releases/download/v0.8.0/dockerize-linux-amd64-v0.8.0.tar.gz | sudo tar -C /usr/local/bin -xzv
|
|
|
|
- name: Wait for MinIO to be ready
|
|
run: |
|
|
dockerize -wait tcp://localhost:9000 -timeout 10s
|
|
|
|
- name: Configure MinIO
|
|
run: |
|
|
MINIO=$(docker ps | grep minio/minio | sed -E 's/.*\s+([a-zA-Z0-9_-]+)$/\1/')
|
|
docker exec ${MINIO} sh -c \
|
|
"mc alias set impress http://localhost:9000 impress password && \
|
|
mc alias ls && \
|
|
mc mb impress/impress-media-storage && \
|
|
mc version enable impress/impress-media-storage"
|
|
|
|
- name: Install Python
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: "3.12.6"
|
|
|
|
- name: Install development dependencies
|
|
run: pip install --user .[dev]
|
|
|
|
- name: Install gettext (required to compile messages) and MIME support
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gettext pandoc shared-mime-info
|
|
sudo wget https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -O /etc/mime.types
|
|
|
|
- name: Generate a MO file from strings extracted from the project
|
|
run: python manage.py compilemessages
|
|
|
|
- name: Run tests
|
|
run: ~/.local/bin/pytest -n 2
|