update workflows

This commit is contained in:
Sina Atalay 2024-02-18 21:40:03 +01:00
parent 140fab5622
commit 7f7fa17f7f
3 changed files with 68 additions and 53 deletions

View File

@ -1,17 +1,18 @@
name: CI
name: Continuous integration
# GitHub events that triggers the workflow:
on:
push:
branches: ["main", "v1"]
branches: ["main", "dev", "v1"]
pull_request:
branches: ["main", "v1"]
release:
types: ["published"]
branches: ["main", "dev", "v1"]
workflow_call:
# The workflow:
jobs:
lint:
runs-on: ubuntu-latest
name: Lint with Ruff (Py${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
@ -54,15 +55,12 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install pytest
pip install .[testing]
pip install .[tests]
- name: Test with pytest
run: |
pip install pytest pytest-cov
touch .coveragerc
echo "[run]" > .coveragerc
echo "relative_files = True" >> .coveragerc
pytest --cov="rendercv" tests/
pip install pytest coverage
coverage run -m pytest tests/
mv .coverage .coverage.${{ matrix.python-version }}.${{ matrix.os }}
- name: Store coverage files
@ -72,7 +70,6 @@ jobs:
path: .coverage.${{ matrix.python-version }}.${{ matrix.os }}
report-coverage:
if: github.event_name == 'push'
name: Generate a coverage report
needs: [test]
runs-on: ubuntu-latest
@ -94,10 +91,6 @@ jobs:
- name: Combine coverage files
run: |
pip install coverage
ls -la coverage
touch .coveragerc
echo "[run]" > .coveragerc
echo "relative_files = True" >> .coveragerc
coverage combine coverage
coverage report
coverage html --show-contexts --title "RenderCV coverage for ${{ github.sha }}"
@ -108,31 +101,6 @@ jobs:
smokeshow upload ./htmlcov
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 97
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
publish:
if: github.event_name == 'release'
name: Publish to PyPI
needs: [test]
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Build
run: |
pip install -U build
python -m build
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

View File

@ -1,25 +1,38 @@
name: Deploy documentation
# GitHub events that triggers the workflow:
on:
push:
branches:
- main
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.11
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
python-version: ${{ matrix.python-version }}
- name: Store cache ID
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Create a key
uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: pip install mkdocstrings-python
- run: mkdocs gh-deploy --force
- name: Deploy documentation
run: |
pip install mkdocs-material
pip install mkdocstrings-python
mkdocs gh-deploy --force

34
.github/workflows/publish.yaml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Publish to PyPI
# GitHub events that triggers the workflow:
on:
release:
types: [released]
jobs:
call_ci_workflow:
name: Continuous integration
uses: ./.github/workflows/ci.yaml
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Build
run: |
pip install -U build
python -m build
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1