Skip to content

Ajoute la génération des smileys au format PNG depuis le SVG #2547

Ajoute la génération des smileys au format PNG depuis le SVG

Ajoute la génération des smileys au format PNG depuis le SVG #2547

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
- cron: "30 3 * * WED" # every Wednesday at 3:30 AM, only main branch
env:
NODE_VERSION: "18" # needs to be also updated in .nvmrc
PYTHON_VERSION: "3.11"
PIP_VERSION: "24.3.1" # needs to be also updated in scripts/define_variable.sh
MARIADB_VERSION: "10.4.10"
COVERALLS_VERSION: "3.3.1" # check if Coverage needs to be also updated in requirements-ci.txt
TYPESENSE_VERSION: "27.0" # needs to be also updated in scripts/define_variable.sh
# As GitHub Action does not allow environment variables
# to be used in services definitions, these are only for
# reference. If you update these versions, you HAVE TO
# update the versions in the services definitions of the
# test job.
MEMCACHED_VERSION: "1.6"
jobs:
# Lint all source files by executing pre-commit hooks.
lint:
name: Lint
runs-on: ubuntu-24.04
# do not execute scheduled jobs on forks:
if: ${{ github.event_name != 'schedule' || github.repository_owner == 'zestedesavoir' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Execute pre-commit
uses: pre-commit/[email protected]
# Build the documentation and upload it as an artifact.
build-doc:
name: Build Sphinx documentation
runs-on: ubuntu-24.04
# do not execute scheduled jobs on forks:
if: ${{ github.event_name != 'schedule' || github.repository_owner == 'zestedesavoir' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Upgrade pip
run: pip install pip==${{ env.PIP_VERSION }}
- name: Retrieve pip cache directory
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install python dependencies
run: pip install -r requirements-dev.txt
- name: Build documentation
run: make generate-doc
- name: Upload documentation as a page artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc/build/html
# Build the website front-end and upload built assets as an artifact.
build-front:
name: Lint and build front-end
runs-on: ubuntu-24.04
# do not execute scheduled jobs on forks:
if: ${{ github.event_name != 'schedule' || github.repository_owner == 'zestedesavoir' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Upgrade pip
run: pip install --upgrade pip
- name: Install cairosvg dependency
run: pip install cairosvg
- name: Set up NodeJS ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Retrieve yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache Node modules
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install front-end
run: make install-front
- name: Lint front-end
run: make lint-front
- name: Build front-end
run: make build-front
- name: Upload font-end assets for subsequent tests
uses: actions/upload-artifact@v4
with:
name: assets
path: dist
retention-days: 1
# Test the zds-site project.
# Install the project, using assets created during the previous job,
# and install Typesense & Memcached as a service. Then, run the tests
# in a matrix build to parallelize multiple components.
test:
name: Install and test zds-site
needs: build-front
runs-on: ubuntu-24.04
strategy:
matrix:
module:
[
"zds.tutorialv2",
"zds.member zds.gallery zds.search zds.middlewares zds.pages",
"zds.forum zds.featured zds.mp zds.notification zds.utils",
]
services:
memcached:
image: "memcached:1.6"
ports:
- "11211:11211"
steps:
- name: Shutdown Ubuntu MySQL
run: sudo service mysql stop
- name: Set up MariaDB ${{ env.MARIADB_VERSION }}
uses: getong/[email protected]
with:
character set server: "utf8mb4"
collation server: "utf8mb4_unicode_ci"
mariadb version: "${{ env.MARIADB_VERSION }}"
mysql database: "ci_db_name"
mysql root password: "ci_root_password"
- name: Start Typesense
uses: jirevwe/[email protected]
with:
typesense-version: ${{ env.TYPESENSE_VERSION }}
typesense-api-key: xyz
- name: Checkout
uses: actions/checkout@v4
- name: Download previously built assets
uses: actions/download-artifact@v4
with:
name: assets
path: dist
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Upgrade pip
run: pip install pip==${{ env.PIP_VERSION }}
- name: Retrieve pip cache directory
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache Node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('zmd/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set up NodeJS ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Install Python dependencies
run: pip install -r requirements-ci.txt
- name: Check that no migration is missing
run: python manage.py makemigrations --check --dry-run
- name: Build and start zmarkdown
run: |
make zmd-install
make zmd-start
- name: Run tests for ${{ matrix.module }}
run: coverage run --source='.' manage.py test -v=2 --keepdb --settings zds.settings.ci_test ${{ matrix.module }}
- name: Analyze coverage
shell: bash -l {0}
run: |
echo $COVERALLS_FLAG_NAME
python -m pip install coveralls==${{ env.COVERALLS_VERSION }}
coveralls --service=github # See https://github.com/TheKevJames/coveralls-python/issues/252
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: "${{ matrix.module }}"
COVERALLS_SERVICE_JOB_ID: "${{ github.run_id }}" # https://github.com/TheKevJames/coveralls-python/issues/252#issuecomment-1823885633
# Push coverage data to Coveralls.
coverage:
name: Push coverage to Coveralls
needs: test
runs-on: ubuntu-24.04
steps:
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Upload coverage data
run: |
python -m pip install coveralls==${{ env.COVERALLS_VERSION }}
coveralls --finish --service=github # See https://github.com/TheKevJames/coveralls-python/issues/252
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# If we're on the dev branch (i.e. for merged pull requests), push the built
# documentation to the gh-page branch.
push_doc:
name: Push documentation to GitHub Pages
needs: ["build-doc", "test"]
runs-on: ubuntu-24.04
if: "github.ref == 'refs/heads/dev'"
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4