Skip to content

💚 Fix build error #184

💚 Fix build error

💚 Fix build error #184

Workflow file for this run

name: Run CI
# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- master
tags:
- '*'
pull_request:
workflow_dispatch:
jobs:
build-js:
runs-on: ubuntu-latest
name: Compile the frontend code
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-js
with:
npm-package: 'true'
django-staticfiles: 'false'
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.10', '3.11', '3.12', '3.13']
django: ['4.2', '5.1', '5.2']
exclude:
- python: '3.13'
django: '4.2'
name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: pip install tox tox-gh-actions
- name: Run tests
run: tox
env:
DJANGO: ${{ matrix.django }}
- name: Publish coverage report
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: reports/
e2e_tests:
runs-on: ubuntu-latest
name: Run the end-to-end tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: ./.github/actions/build-js
with:
npm-package: 'false'
django-staticfiles: 'true'
- name: Install dependencies
run: |
pip install tox tox-gh-actions pytest-playwright
playwright install --with-deps chromium
- name: Run tests
run: tox -e e2e
- name: Publish coverage report
uses: codecov/codecov-action@v3
with:
directory: reports/
publish:
name: Publish packages to PyPI and NPM
runs-on: ubuntu-latest
needs:
- tests
- e2e_tests
if: github.repository == 'django-commons/django-cookie-consent' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
environment:
name: release
url: https://pypi.org/project/django-cookie-consent/
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/setup-node@v4
with:
node-version-file: 'js/.nvmrc'
cache: npm
cache-dependency-path: js/package-lock.json
registry-url: 'https://registry.npmjs.org'
# Required to ensure the build artifacts are in the packages.
- uses: ./.github/actions/build-js
with:
npm-package: 'true'
django-staticfiles: 'true'
- name: Build sdist and wheel
run: |
pip install build --upgrade
python -m build
# TODO: enable verified publishing!
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish NPM package
run: |
version=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
npm publish --new-version="$version"
working-directory: js
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}