Skip to content

Commit

Permalink
👷 Refactoring workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
WiredNerd committed Dec 23, 2023
1 parent c0aa670 commit 45c4aaa
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python Mutation Test
name: Mutmut

on:
workflow_dispatch:
Expand All @@ -17,20 +17,26 @@ jobs:
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install mutmut --upgrade
pip install --editable .
- name: Mutmut
run: python3 -m mutmut run --no-progress --rerun-all --paths-to-mutate src --runner "pytest --exitfirst --assert=plain --sort-mode=diffcov" || true
- run: python3 -m mutmut results
- name: Mutmut Run
run: python3 -m mutmut run --no-progress --rerun-all --paths-to-mutate src
- name: Mutmut Results
if: ${{ always() }}
run: python3 -m mutmut results
- name: Mutmut Report
if: ${{ always() }}
run: |
python3 -m mutmut html
python3 -m mutmut junitxml > mutation-testing-report.xml
head mutation-testing-report.xml -n 3
- name: save-reports
- name: Upload Report HTML
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: Mutation testing report
name: Mutation testing report HTML
path: html
- name: Upload Report XML
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: Mutation testing report XML
path: mutation-testing-report.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Python Mutation Test
name: Poodle Mutation Test

on:
workflow_dispatch:

concurrency: updates-project

jobs:
poodle:
name: Mutation Test with Poodle
runs-on: [macos-latest]
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
Expand All @@ -19,11 +17,5 @@ jobs:
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install --editable .
- name: Poodle
run: poodle --report json || true
- name: save-json-report
if: ${{ github.ref_name == 'main' }}
uses: EndBug/add-and-commit@v9
with:
add: "mutation-testing-report.json"
pull: "--rebase=true --autostash"
- run: poodle

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ on:
push:
paths:
- .github/workflows/python-test-matrix.yml
pull_request:
paths:
- requirements.txt
- src/**
- tests/**
pull_request:
branches-ignore:
- docs
workflow_dispatch:

jobs:
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ on:
types: [published]
workflow_dispatch:

concurrency: updates-project

permissions:
contents: write
contents: read

jobs:
deploy:
Expand All @@ -37,23 +35,7 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install build setuptools twine --upgrade
- name: Read Version
uses: SebRollen/toml-action@v1.0.2
id: read_vesion
with:
file: 'pyproject.toml'
field: 'project.version'
- name: Set version in code
run: |
echo "Setting version to ${{ steps.read_vesion.outputs.value }}"
sed -i 's/__version__ = "[0-9]\+\.[0-9]\+\.[0-9]\+"/__version__ = "${{ steps.read_vesion.outputs.value }}"/g' src/poodle/__init__.py
- name: commit-version
uses: EndBug/add-and-commit@v9
with:
add: "src/poodle/__init__.py"
pull: "--rebase=true --autostash"
- name: Build package
run: python -m build
- name: Publish package
if: ${{ github.ref_name == 'main' }}
uses: pypa/gh-action-pypi-publish@release/v1
20 changes: 9 additions & 11 deletions .github/workflows/python-test-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ on:
push:
paths:
- .github/workflows/python-test-scan.yml
pull_request:
paths:
- requirements.txt
- src/**
- tests/**
pull_request:
branches-ignore:
- docs
workflow_dispatch:

concurrency: updates-project

jobs:
pytest-cov:
name: Unit Test with Pytest
Expand All @@ -27,17 +26,16 @@ jobs:
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
- run: pytest --cov=src --cov-report=json:code-coverage.json
- name: commit-json-report
if: ${{ github.ref_name == 'main' }}
uses: EndBug/add-and-commit@v9
with:
add: "code-coverage.json"
pull: "--rebase=true --autostash"
- name: artifact-html-report
uses: actions/upload-artifact@v3
with:
name: Coverage Report
name: Coverage Report HTML
path: cov-html
- name: artifact-json-report
uses: actions/upload-artifact@v3
with:
name: Coverage Report JSON
path: code-coverage.json
isort:
name: Import Checks with ISort
runs-on: [ubuntu-latest]
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/update-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Update Coverage Reports

on:
push:
branches:
- main
workflow_dispatch:

concurrency: updates-project

jobs:
pytest-coverage:
name: Pytest Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
- run: pytest --cov=src --cov-report=json:code-coverage.json
- name: commit-json-report
if: ${{ github.ref_name == 'main' }}
uses: EndBug/add-and-commit@v9
with:
add: "code-coverage.json"
pull: "--rebase=true --autostash"
- name: artifact-html-report
uses: actions/upload-artifact@v3
with:
name: Coverage Report
path: cov-html
poodle:
name: Mutation Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies and Tools
run: |
python3 -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install --editable .
- name: Poodle
run: poodle --report json || true
- name: save-json-report
if: ${{ github.ref_name == 'main' }}
uses: EndBug/add-and-commit@v9
with:
add: "mutation-testing-report.json"
pull: "--rebase=true --autostash"
33 changes: 33 additions & 0 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update Version from pyproject.toml

on:
push:
paths:
- 'pyproject.toml'
branches-ignore:
- docs
workflow_dispatch:

concurrency: updates-project

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read Version
uses: SebRollen/toml-action@v1.0.2
id: read_vesion
with:
file: 'pyproject.toml'
field: 'project.version'
- name: Set version in code
run: |
echo "Setting version to ${{ steps.read_vesion.outputs.value }}"
sed -i 's/__version__ = "[0-9]\+\.[0-9]\+\.[0-9]\+"/__version__ = "${{ steps.read_vesion.outputs.value }}"/g' src/poodle/__init__.py
- name: commit-version
uses: EndBug/add-and-commit@v9
with:
add: "src/poodle/__init__.py"
pull: "--rebase=true --autostash"

0 comments on commit 45c4aaa

Please sign in to comment.