2024-02-24 19:48:26 +00:00
|
|
|
name: Tests
|
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-02-19 19:41:47 +00:00
|
|
|
branches: ["main", "dev", "v1"]
|
2023-10-14 19:49:43 +00:00
|
|
|
pull_request:
|
2024-02-19 19:41:47 +00:00
|
|
|
branches: ["main", "dev", "v1"]
|
2024-02-18 20:40:03 +00:00
|
|
|
workflow_call:
|
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 }}
|
|
|
|
|
2023-10-14 19:49:43 +00:00
|
|
|
- name: Lint with Ruff
|
|
|
|
run: |
|
2024-02-28 20:18:15 +00:00
|
|
|
pip install .[tests]
|
2023-10-14 19:49:43 +00:00
|
|
|
ruff --output-format=github .
|
|
|
|
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 }}
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2024-02-18 20:40:03 +00:00
|
|
|
pip install .[tests]
|
2023-10-14 19:49:43 +00:00
|
|
|
|
|
|
|
- name: Test with pytest
|
|
|
|
run: |
|
2024-02-18 20:40:03 +00:00
|
|
|
coverage run -m pytest tests/
|
2023-10-14 19:49:43 +00:00
|
|
|
mv .coverage .coverage.${{ matrix.python-version }}.${{ matrix.os }}
|
|
|
|
|
|
|
|
- name: Store coverage files
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: coverage
|
|
|
|
path: .coverage.${{ matrix.python-version }}.${{ matrix.os }}
|
|
|
|
|
2023-12-03 17:12:36 +00:00
|
|
|
report-coverage:
|
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
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: coverage
|
|
|
|
path: coverage
|
|
|
|
|
|
|
|
- name: Combine coverage files
|
|
|
|
run: |
|
2024-02-28 20:18:15 +00:00
|
|
|
pip install .[tests]
|
2023-10-14 19:49:43 +00:00
|
|
|
coverage combine coverage
|
|
|
|
coverage report
|
|
|
|
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 }}
|