mirror of
https://github.com/pufereq/python-template.git
synced 2025-12-15 07:39:32 +00:00
ci: add workflows
This commit is contained in:
49
.github/workflows/coverage.yaml
vendored
Normal file
49
.github/workflows/coverage.yaml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: Code coverage
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
comment_coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: GH_TOKEN
|
||||
if: env.GH_TOKEN == ''
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV
|
||||
|
||||
- name: 🔀 checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: "${{ env.GH_TOKEN }}"
|
||||
|
||||
- name: 🐍 python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: 📦 setup pdm
|
||||
uses: pdm-project/setup-pdm@v4
|
||||
with:
|
||||
cache: true
|
||||
|
||||
- name: 📦 install dependencies
|
||||
run: |
|
||||
pdm install
|
||||
|
||||
- name: configure git
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||
- name: 🧪 run coverage
|
||||
run: |
|
||||
pdm run pytest --cov --junitxml=pytest.xml --cov-report=term-missing | tee pytest-coverage.txt
|
||||
- name: 📊 comment coverage
|
||||
uses: MishaKav/pytest-coverage-comment@main
|
||||
with:
|
||||
pytest-coverage-path: pytest-coverage.txt
|
||||
junitxml-path: pytest.xml
|
||||
11
.github/workflows/release.yaml
vendored
11
.github/workflows/release.yaml
vendored
@@ -38,9 +38,16 @@ env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
jobs:
|
||||
create_version:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
name: Create version from tag
|
||||
steps:
|
||||
- name: Test
|
||||
uses: ./.github/actions/test
|
||||
bump_version:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
name: Bump version and create release
|
||||
steps:
|
||||
- name: GH_TOKEN
|
||||
if: env.GH_TOKEN == ''
|
||||
|
||||
38
.github/workflows/test.yaml
vendored
Normal file
38
.github/workflows/test.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Run tests only
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🔀 checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🐍 python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: 📦 setup pdm
|
||||
uses: pdm-project/setup-pdm@v4
|
||||
with:
|
||||
cache: true
|
||||
|
||||
- name: 📦 install dependencies
|
||||
run: |
|
||||
pdm install
|
||||
|
||||
- name: 🧪 run tests
|
||||
id: test
|
||||
run: |
|
||||
pdm run pytest -v
|
||||
Reference in New Issue
Block a user