rendercv/.github/workflows/test.yaml

109 lines
2.9 KiB
YAML
Raw Normal View History

name: Test
2023-10-14 19:49:43 +00:00
2024-02-18 20:40:03 +00:00
# GitHub events that triggers the workflow:
2023-10-14 19:49:43 +00:00
on:
push:
2024-03-09 18:04:26 +00:00
branches: ["main", "dev"]
2023-10-14 19:49:43 +00:00
pull_request:
2024-03-09 18:04:26 +00:00
branches: ["main", "dev"]
2024-03-09 18:39:59 +00:00
workflow_call: # to make the workflow triggerable from other workflows (publish.yaml)
2023-10-14 19:49:43 +00:00
2024-02-18 20:40:03 +00:00
# The workflow:
2023-10-14 19:49:43 +00:00
jobs:
lint:
2023-10-28 00:40:44 +00:00
name: Lint with Ruff (Py${{ matrix.python-version }})
2024-02-18 20:40:03 +00:00
runs-on: ubuntu-latest
2023-10-14 19:49:43 +00:00
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
2023-10-14 20:17:51 +00:00
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
2024-06-19 11:42:59 +00:00
- name: Install Hatch
uses: pypa/hatch@install
2023-10-14 19:49:43 +00:00
- name: Lint with Ruff
run: |
2024-06-19 11:34:05 +00:00
hatch run lint
2023-10-14 19:49:43 +00:00
continue-on-error: true
test:
2023-10-16 16:06:19 +00:00
name: Test with Py${{ matrix.python-version }} on ${{ matrix.os }}
2023-10-14 19:49:43 +00:00
strategy:
fail-fast: false
matrix:
2023-10-15 17:51:38 +00:00
os: [ubuntu, windows, macos]
2023-10-14 19:49:43 +00:00
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
2024-02-09 19:36:50 +00:00
with:
submodules: recursive
2023-10-14 19:49:43 +00:00
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
2024-06-19 11:42:59 +00:00
- name: Install Hatch
uses: pypa/hatch@install
2023-10-14 19:49:43 +00:00
2024-06-19 11:34:05 +00:00
- name: Test
2023-10-14 19:49:43 +00:00
run: |
2024-06-19 11:42:59 +00:00
hatch run test:coverage run -m pytest
2023-10-14 19:49:43 +00:00
mv .coverage .coverage.${{ matrix.python-version }}.${{ matrix.os }}
- name: Store coverage files
2024-03-09 18:18:59 +00:00
uses: actions/upload-artifact@v3
2023-10-14 19:49:43 +00:00
with:
name: coverage
path: .coverage.${{ matrix.python-version }}.${{ matrix.os }}
2023-12-03 17:12:36 +00:00
report-coverage:
2024-03-09 18:04:26 +00:00
# Run only if the workflow was triggered by a push event
if: github.event_name == 'push'
2024-02-20 19:11:27 +00:00
name: Generate the coverage report
2023-10-14 19:49:43 +00:00
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Download coverage files
2024-03-09 18:18:59 +00:00
uses: actions/download-artifact@v3
2023-10-14 19:49:43 +00:00
with:
name: coverage
path: coverage
2024-06-19 11:42:59 +00:00
- name: Install Hatch
uses: pypa/hatch@install
2023-10-14 19:49:43 +00:00
- name: Combine coverage files
run: |
2024-06-19 11:34:05 +00:00
hatch run test:coverage combine coverage
hatch run test:coverage report
hatch run test:coverage html --show-contexts --title "RenderCV coverage for ${{ github.sha }}"
2023-10-14 21:59:57 +00:00
2024-02-20 19:11:27 +00:00
- name: Upload the coverage report to smokeshow
2023-10-14 19:49:43 +00:00
run: |
2024-02-28 20:18:15 +00:00
pip install smokeshow==0.4.0
2023-10-14 19:49:43 +00:00
smokeshow upload ./htmlcov
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
2024-02-18 20:40:03 +00:00
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 97
2023-10-14 19:49:43 +00:00
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}