PDF Combine CI/CD #6
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: PDF Combine CI/CD | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: ['3.11'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest pytest-cov pytest-benchmark pytest-mock | |
- name: Run core tests | |
run: | | |
pytest tests/ -v -m "not benchmark and not win32" --cov=src/ --cov-report=xml --cov-report=html | |
- name: Run Windows-specific tests | |
if: runner.os == 'Windows' | |
run: | | |
pytest tests/ -v -m "win32" --cov=src/ --cov-report=xml --cov-report=html --cov-append | |
- name: Run benchmark tests | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: | | |
pytest tests/ -v -m "benchmark" --benchmark-only | |
- name: Upload coverage reports | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.xml | |
flags: unittests | |
name: codecov-pdf-combine | |
fail_ci_if_error: false | |
- name: Upload benchmark results | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: benchmark-results | |
path: .benchmarks/ | |
- name: Upload coverage HTML report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: htmlcov/ | |
build: | |
needs: test | |
runs-on: windows-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
- name: Build executable | |
run: python build.py | |
- name: Create release assets | |
run: | | |
mkdir release | |
copy "dist/PDF Combine.exe" release/ | |
copy LICENSE release/ | |
copy README.md release/ | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pdf-combine-windows | |
path: release/ | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: release/* | |
body_path: CHANGELOG.md | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |