Skip to content

Commit

Permalink
Merge pull request #34 from dsj7419/feature/add-new-workflow
Browse files Browse the repository at this point in the history
ci: update GitHub workflows and add coverage config
  • Loading branch information
dsj7419 authored Nov 3, 2024
2 parents 8012edf + 7afc26c commit 5c5755f
Show file tree
Hide file tree
Showing 19 changed files with 556 additions and 256 deletions.
24 changes: 24 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[run]
source = src
branch = True
omit =
*/test_*.py
*/conftest.py
*/runners.py
*/run_tests.py

[report]
exclude_lines =
pragma: no cover
def __repr__
raise NotImplementedError
if __name__ == .__main__.:
pass
raise ImportError
except ImportError:

[html]
directory = tests/reports/coverage/html

[xml]
output = tests/reports/coverage/coverage.xml
45 changes: 45 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,64 @@ updates:
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 10
target-branch: "main"
labels:
- "dependencies"
- "pip"
reviewers:
- "dsj7419"
groups:

test-dependencies:
patterns:
- "pytest*"
- "coverage"
- "flake8"
- "black"
- "mypy"

gui-dependencies:
patterns:
- "PyQt5*"
commit-message:
prefix: "deps"
include: "scope"

ignore:
- dependency-name: "PyQt5*"
update-types: ["version-update:semver-major"]

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 10
labels:
- "dependencies"
- "github-actions"
groups:
github-actions:
patterns:
- "*"
commit-message:
prefix: "ci"
include: "scope"


- package-ecosystem: "pip"
directory: "/docs"
schedule:
interval: "monthly" s
labels:
- "dependencies"
- "documentation"
groups:
docs-dependencies:
patterns:
- "mkdocs*"
- "*-material*"
102 changes: 102 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: CI

on:
push:
branches: [main, develop]
paths-ignore:
- "docs/**"
- "**.md"
- "artwork/**"
pull_request:
branches: [main, develop]
paths-ignore:
- "docs/**"
- "**.md"
- "artwork/**"

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.12"]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xfixes0 x11-utils
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Code Quality Checks
run: |
black --check src tests
flake8 src tests
isort --check-only src tests
mypy src --ignore-missing-imports
- name: Run Tests (Windows)
if: runner.os == 'Windows'
env:
GITHUB_CI: "true"
CONFIG_FILE: "tests/github_ci_config.json"
run: |
python run_tests.py --ci --debug --config tests/github_ci_config.json
- name: Run Tests (Linux)
if: runner.os == 'Linux'
env:
GITHUB_CI: "true"
CONFIG_FILE: "tests/github_ci_config.json"
DISPLAY: ":99"
run: |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
python run_tests.py --ci --debug --config tests/github_ci_config.json
- name: Process Test Results
if: always()
run: |
python -c "
import json, sys
with open('tests/reports/latest_results.json') as f:
results = json.load(f)
sys.exit(0 if results.get('success') else 1)
"
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.os }}
path: |
tests/reports/coverage/
tests/reports/html/
tests/reports/logs/
tests/reports/latest_results.json
retention-days: 14

- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
files: ./tests/reports/coverage/coverage.xml
fail_ci_if_error: true
verbose: true
30 changes: 24 additions & 6 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,54 @@ on:
- "docs/**"
- "**.md"
- "mkdocs.yml"
- "requirements-docs.txt"
branches:
- main
pull_request:
paths:
- "docs/**"
- "**.md"
- "mkdocs.yml"
- "requirements-docs.txt"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper versioning

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs-material mkdocs-awesome-pages-plugin mkdocs-minify-plugin
pip install -r requirements-docs.txt
- name: Build documentation
run: mkdocs build --strict
- name: Check documentation links
run: |
mkdocs build --strict
- name: Deploy to GitHub Pages
- name: Deploy Documentation
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
commit_message: |
Deploy documentation updates
Triggered by ${{ github.sha }}
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
full_commit_message: |
Deploy documentation updates
Triggered by ${{ github.sha }}
Commit messages:
${{ github.event.commits[0].message }}
50 changes: 0 additions & 50 deletions .github/workflows/quality.yml

This file was deleted.

74 changes: 0 additions & 74 deletions .github/workflows/release.yml

This file was deleted.

Loading

0 comments on commit 5c5755f

Please sign in to comment.