Merge pull request #116 from SukiCZ/dependabot/github_actions/codecov… #290
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 | |
# Enable Buildkit and let compose use it to speed up image building | |
env: | |
DOCKER_BUILDKIT: 1 | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
on: | |
pull_request: | |
branches: [ 'master', 'main' ] | |
push: | |
branches: [ 'master', 'main' ] | |
tags: | |
- 'v*' | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
linter: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.11' | |
- name: Install xmllint | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libxml2-utils | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code Repository | |
uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.11' | |
- name: Install tox | |
run: pip install tox | |
- name: Run tox | |
run: tox | |
- name: Upload coverage to Codecov | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
publish: | |
runs-on: ubuntu-latest | |
needs: [linter, test] | |
if: startsWith(github.ref, 'refs/tags/v') | |
# Specifying a GitHub environment is optional, but strongly encouraged | |
environment: release | |
permissions: | |
# IMPORTANT: this permission is mandatory for trusted publishing | |
id-token: write | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build setuptools wheel twine | |
- name: Build a binary wheel and a source tarball | |
run: >- | |
python -m | |
build | |
--sdist | |
--wheel | |
--outdir dist/ | |
- name: Build and publish 📦 to PyPI | |
uses: pypa/[email protected] |