Skip to content

Make cairocffi optional: lazy import only when render pipeline is used #156

Make cairocffi optional: lazy import only when render pipeline is used

Make cairocffi optional: lazy import only when render pipeline is used #156

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
schedule:
# Run monthly on the 1st at 00:00 UTC
- cron: '0 0 1 * *'
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.9"
toxenv: py39
- python-version: "3.10"
toxenv: py310
- python-version: "3.11"
toxenv: py311
- python-version: "3.12"
toxenv: py312
- python-version: "3.13"
toxenv: py313
- python-version: "3.14"
toxenv: py314
- python-version: "3.x"
toxenv: no-flask-caching
- python-version: "3.12"
toxenv: cairo
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install tox
run: pip install tox
- name: Run tests with tox
run: tox -e ${{ matrix.toxenv }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
cache: 'pip'
- name: Build release distributions
run: |
python -m pip install build
python -m build
- name: Upload distributions
uses: actions/upload-artifact@v6
with:
name: dist
path: dist/
docs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
cache: 'pip'
- name: Install documentation dependencies
run: |
python -m pip install -e ".[docs]"
- name: Build documentation
run: |
cd docs
make html
- name: Upload documentation
uses: actions/upload-artifact@v6
with:
name: docs
path: docs/_build/html/
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./docs/_build/html/
create-issue-on-failure:
runs-on: ubuntu-latest
needs: [test, build, docs]
if: always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && github.event_name == 'schedule'
permissions:
issues: write
steps:
- name: Create issue on failure
uses: actions/github-script@v8
with:
script: |
const title = 'Scheduled Tests Failed';
const workflowUrl = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
const timestamp = new Date().toISOString();
const body = `The scheduled test run failed on ${timestamp}.
**Workflow Run:** ${workflowUrl}
Please investigate the failure and fix any issues.`;
const commentBody = `Another test failure occurred on ${timestamp}.
**Workflow Run:** ${workflowUrl}`;
// Check if there's already an open issue with the same title
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: ['automated-test-failure']
});
const existingIssue = issues.data.find(issue => issue.title === title);
if (existingIssue) {
// Add a comment to the existing issue
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existingIssue.number,
body: commentBody
});
} else {
// Create a new issue
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['automated-test-failure']
});
}