CI build #1234
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
- name: Lint with tox | |
run: tox -e check | |
lint-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
- name: Lint README.md | |
uses: docker://avtodev/markdown-lint:v1 | |
with: | |
args: './README.md' | |
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 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 | |
- lint-readme | |
- test | |
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 }} |