Skip to content

Merge pull request #590 from languitar/renovate/codecov-codecov-actio… #2424

Merge pull request #590 from languitar/renovate/codecov-codecov-actio…

Merge pull request #590 from languitar/renovate/codecov-codecov-actio… #2424

Workflow file for this run

name: CI build
on:
push:
branches:
- main
pull_request: {}
schedule:
- cron: '0 0 * * 0'
jobs:
lint-commits:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6
lint-code:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get -y install libdbus-1-dev libgirepository1.0-dev
- name: Cache Python packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: lint-code-${{ hashFiles('setup.py') }}-${{ hashFiles('tox.ini') }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Lint with tox
run: tox -e check
docs:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get -y install libdbus-1-dev libgirepository1.0-dev plantuml
- name: Cache Python packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: docs-${{ hashFiles('setup.py') }}-${{ hashFiles('tox.ini') }}-${{ hashFiles('requirements-doc.txt') }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Build Sphinx docs
run: tox -e docs
test-mindeps:
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Cache Python packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: test-mindeps-${{ hashFiles('setup.py') }}-${{ hashFiles('tox.ini') }}
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test execution with minimal dependencies
run: tox -e mindeps
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get -y install libdbus-1-dev libgirepository1.0-dev
- name: Cache Python packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: test-${{ hashFiles('setup.py') }}-${{ hashFiles('tox.ini') }}-${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install coverage tox tox-gh-actions
- name: Test with tox
run: |
tox
coverage xml --rcfile=setup.cfg
- name: Publish coverage to codecov.io
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- lint-code
- test-mindeps
- test
- docs
steps:
- name: 'Generate token'
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.RELEASE_APP_ID }}
private_key: ${{ secrets.RELEASE_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache Node packages
uses: actions/cache@v4
with:
path: node_modules
key: release-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}