Skip to content

Bump the npm group across 1 directory with 3 updates #293

Bump the npm group across 1 directory with 3 updates

Bump the npm group across 1 directory with 3 updates #293

Workflow file for this run

name: 'Build & Test CI'
on:
push:
branches:
- main
tags:
- v**
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 0 1,16 * *'
jobs:
check_conventions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: python-setup
with:
python-version: ${{ matrix.python-version }}
- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: '~/.cache/pre-commit'
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
- run: pipx run pre-commit run --all-files
build:
needs: [check_conventions]
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
python-version:
- '3.x'
node-version:
- '16.x'
runs-on: ${{ matrix.os }}
steps:
- if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgl-dev libglvnd-dev libxkbcommon-x11-0
echo "QT_QPA_PLATFORM=offscreen" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
# Need full history to determine version number.
fetch-depth: 0
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache node.js modules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- run: pip install build
- name: Cache generated package data
uses: actions/cache@v4
with:
path: 'src/sphinx_social_cards/.*/**'
key: ${{ runner.os }}-pkg_data-${{ hashFiles('**/package-lock.json', 'setup.py') }}
- name: Build binary distribution
run: python -m build -w
- name: Build src distribution
if: runner.os == 'Linux'
env:
# skip re-generating the same assets that was already done when building the wheel
SPHINX_SOCIAL_CARDS_BUILD_DIRTY: 'true'
run: python -m build -s
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
name: python-packages-${{ runner.os }}
path: |
dist/*.whl
dist/*.tar.*
docs:
needs: [build]
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
python-version:
- '3.x'
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgl-dev libglvnd-dev libxkbcommon-x11-0
echo "QT_QPA_PLATFORM=offscreen" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: python-packages-${{ runner.os }}
path: dist
- name: Install wheel
shell: bash
run: python -m pip install $(ls dist/*.whl)
- name: Cache fonts for built docs
uses: actions/cache@v4
with:
path: docs/_build/html/_static/fonts
key: docs-build-fonts-${{ runner.os }}
- name: Build docs
env:
GITHUB_REST_API_TOKEN: ${{ secrets.TEST_VCS_PLUGIN_GITHUB }}
SPHINX_IMMATERIAL_EXTERNAL_RESOURCE_CACHE_DIR: docs/_build/html/_static/fonts
run: pipx run nox -s "docs(html)"
- name: Cache docs theme build assets
uses: actions/cache/save@v4
with:
path: docs/_build/html/_static/fonts
key: sphinx-immaterial-assets_${{ runner.os }}-${{ github.run_id }}
- name: Upload doc builds as artifacts
uses: actions/upload-artifact@v4
with:
name: doc-builds-${{ runner.os }}
path: docs/_build/html
- name: upload docs to github pages
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && runner.os == 'Linux'
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: docs/_build/html
github_token: ${{ secrets.GITHUB_TOKEN }}
test:
needs: [check_conventions, build, docs]
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
sphinx-version:
- 'sphinx4'
- 'sphinx5'
- 'sphinx6'
- 'sphinx7'
runs-on: ${{ matrix.os }}
steps:
- if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgl-dev libglvnd-dev libxkbcommon-x11-0
echo "QT_QPA_PLATFORM=offscreen" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
id: python-setup
with:
python-version: ${{ matrix.python-version }}
- name: Cache nox env
uses: actions/cache@v4
with:
path: "**/.nox"
key: ${{ runner.os }}-${{ steps.python-setup.outputs.python-version }}-nox-${{ hashFiles('noxfile.py') }}
- name: Cache generated package data
uses: actions/cache/restore@v4
with:
path: 'src/sphinx_social_cards/.*/**'
key: ${{ runner.os }}-pkg_data-${{ hashFiles('**/package-lock.json', 'setup.py') }}
- name: Cache sphinx-immaterial theme build assets
uses: actions/cache/restore@v4
with:
path: docs/_build/html/_static/fonts
key: sphinx-immaterial-assets_${{ runner.os }}-${{ github.run_id }}
- name: Run Python tests
env:
COVERAGE_FILE: .coverage.${{ github.run_id }}.${{ github.run_attempt }}.${{ runner.os }}.${{ matrix.python-version }}.${{ matrix.sphinx-version }}
GITHUB_REST_API_TOKEN: ${{ secrets.TEST_VCS_PLUGIN_GITHUB }}
SPHINX_IMMATERIAL_EXTERNAL_RESOURCE_CACHE_DIR: docs/_build/html/_static/fonts
run: pipx run nox -s "tests-${{ matrix.python-version }}(${{ matrix.sphinx-version }})"
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.sphinx-version }}
path: .coverage*
coverage-report:
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ci-artifacts
- run: mv ci-artifacts/**/.coverage* ./
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Create coverage report
run: pipx run nox -s coverage
- name: Upload comprehensive coverage HTML report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: htmlcov/
- name: Post coverage summary
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
python-publish-package:
# Only publish package on push to tag or default branch.
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
needs: [build, test]
steps:
- uses: actions/download-artifact@v4
with:
name: python-packages-Linux
path: dist
- name: Publish to PyPI (test server)
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
run: pipx run twine upload --repository testpypi dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
- name: Publish to PyPI (main server)
if: startsWith(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: pipx run twine upload dist/*