mirror of
https://github.com/suitenumerique/drive.git
synced 2026-10-17 21:55:06 +02:00
MinIO no longer publishes images on Docker Hub and has been trimming its community edition. RustFS is Apache 2.0 and exposes the same S3 API, so the switch only touches the compose stack, the dev configuration and the CI storage service. The bucket is now created with the aws cli instead of mc. RustFS runs as a non-root user, so the CI service runs as root to write to the runner's /data/media.
172 lines
5.2 KiB
YAML
172 lines
5.2 KiB
YAML
name: Main Workflow
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
|
|
jobs:
|
|
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@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: show
|
|
run: git log
|
|
- name: Enforce absence of print statements in code
|
|
if: always()
|
|
run: |
|
|
! git diff origin/${{ github.event.pull_request.base.ref }}..HEAD -- . ':(exclude)**/drive.yml' ':(exclude)**/pdf.worker.mjs' ':(exclude)**/printImage.ts' ':(exclude)**/image-preview.spec.ts' | grep "print("
|
|
- name: Check absence of fixup commits
|
|
if: always()
|
|
run: |
|
|
! git log | grep 'fixup!'
|
|
- name: Install gitlint
|
|
if: always()
|
|
run: pip install --user requests gitlint
|
|
- name: Lint commit messages added to main
|
|
if: always()
|
|
run: ~/.local/bin/gitlint --commits origin/${{ github.event.pull_request.base.ref }}..HEAD
|
|
|
|
check-changelog:
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
contains(github.event.pull_request.labels.*.name, 'noChangeLog') == false &&
|
|
github.event_name == 'pull_request'
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 50
|
|
- name: Check that the CHANGELOG has been modified in the current branch
|
|
run: git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.after }} | grep 'CHANGELOG.md'
|
|
|
|
lint-changelog:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Check CHANGELOG max line length
|
|
run: |
|
|
max_line_length=$(cat CHANGELOG.md | grep -Ev "^\[.*\]: https://github.com" | wc -L)
|
|
if [ $max_line_length -ge 80 ]; then
|
|
echo "ERROR: CHANGELOG has lines longer than 80 characters."
|
|
exit 1
|
|
fi
|
|
|
|
build-mails:
|
|
uses: ./.github/workflows/build-mails.yml
|
|
|
|
lint-back:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src/backend
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: "Set up Python"
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version-file: "src/backend/pyproject.toml"
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
- name: Install the project
|
|
run: uv sync --locked --all-extras
|
|
|
|
- name: Check code formatting with ruff
|
|
run: uv run ruff format . --diff
|
|
- name: Lint code with ruff
|
|
run: uv run ruff check .
|
|
- name: Lint code with pylint
|
|
run: uv run pylint .
|
|
|
|
test-back:
|
|
runs-on: ubuntu-latest
|
|
needs: build-mails
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: src/backend
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16
|
|
env:
|
|
POSTGRES_DB: drive
|
|
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: drive.settings
|
|
DJANGO_SECRET_KEY: ThisIsAnExampleKeyForTestPurposeOnly
|
|
OIDC_OP_JWKS_ENDPOINT: /endpoint-for-test-purpose-only
|
|
DJANGO_EMAIL_HOST: mailcatcher
|
|
DB_HOST: localhost
|
|
DB_NAME: drive
|
|
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: drive
|
|
AWS_S3_SECRET_ACCESS_KEY: password
|
|
AWS_S3_REGION_NAME: eu-east-1
|
|
MEDIA_BASE_URL: http://localhost:8083
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- 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') }}
|
|
|
|
- name: Start and configure RustFS
|
|
working-directory: .
|
|
run: |
|
|
bin/compose up -d --wait rustfs-ci
|
|
bin/compose run createbuckets-ci
|
|
|
|
- name: "Set up Python"
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version-file: "src/backend/pyproject.toml"
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
|
|
- name: Install the dependencies
|
|
run: uv sync --locked --all-extras
|
|
|
|
- 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://raw.githubusercontent.com/suitenumerique/django-lasuite/refs/heads/main/assets/conf/mime.types -O /etc/mime.types
|
|
|
|
- name: Generate a MO file from strings extracted from the project
|
|
run: uv run python manage.py compilemessages
|
|
|
|
- name: Run tests
|
|
run: uv run pytest -n 2
|