Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul PyDesigner Code 2 #312

Draft
wants to merge 66 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
1ecade2
Enable pre-commit autofixes
TheJaeger Nov 3, 2023
60d9ba1
Refine pre-commit action
TheJaeger Nov 3, 2023
b656dc6
f
TheJaeger Nov 3, 2023
efb7702
Resolve pre-commit issues
TheJaeger Nov 3, 2023
b3709c0
Modify poetry-export hook
TheJaeger Nov 3, 2023
0ccd59f
Update poetry-export hook
TheJaeger Nov 3, 2023
d8491ed
Fix pre-commit issues
TheJaeger Nov 3, 2023
39bda17
Refile CI workflow
TheJaeger Nov 3, 2023
05935db
Pre-commit fixes
TheJaeger Nov 3, 2023
8722fee
Fix token
TheJaeger Nov 3, 2023
32b165f
Merge remote-tracking branch 'origin/feature/project-overhaul-2' into…
TheJaeger Nov 3, 2023
05077d9
Test hook
TheJaeger Nov 3, 2023
df52aab
Pre-commit autofix
TheJaeger Nov 3, 2023
3442c57
Fix version metadata
TheJaeger Jan 12, 2024
202652d
Refinements
TheJaeger Jan 17, 2024
5b63fa6
Pre-commit autofix
TheJaeger Jan 17, 2024
38b5e2a
Save work
TheJaeger May 4, 2024
b20dd3c
Pre-commit autofix
TheJaeger May 4, 2024
94b3ab9
Add missing requirements
TheJaeger May 4, 2024
ea5d977
Merge branch 'feature/project-overhaul-2' of https://github.com/muscb…
TheJaeger May 4, 2024
6ecdb4b
Fix outdated ref to seaborn plot style
TheJaeger May 5, 2024
d7dc604
Save progress
TheJaeger Jun 2, 2024
6a90a54
Update pre-commit hooks
TheJaeger Jun 2, 2024
1ff58a1
Update requirements
TheJaeger Sep 9, 2024
ee8c8de
Add Docker integrated unit tests
TheJaeger Sep 10, 2024
271b9e0
Update Docker file to use UV
TheJaeger Sep 10, 2024
d48ac50
Update PyDesigner Dockerfile to use UV
TheJaeger Sep 10, 2024
ce158a4
Pre-commit autofix
TheJaeger Sep 10, 2024
eb4e59d
Auto stash before merge of "feature/project-overhaul-2" and "origin/f…
TheJaeger Sep 10, 2024
97f7a87
Fix unit test workflow
TheJaeger Sep 10, 2024
519a302
Pre-commit autofix
TheJaeger Sep 10, 2024
adf4431
Enable tests
TheJaeger Sep 10, 2024
b29a746
Pre-commit autofix
TheJaeger Sep 10, 2024
43187bb
Fix ununused var
TheJaeger Sep 10, 2024
e1fb7ac
Update base images and enable GH Action cache for Docker builds
TheJaeger Sep 10, 2024
b119613
Fix base Docker image
TheJaeger Sep 10, 2024
cdcbe90
Fix workflow file
TheJaeger Sep 10, 2024
bd04c33
Another quick fix
TheJaeger Sep 10, 2024
5572155
Add support for Docker image loading
TheJaeger Sep 10, 2024
0537a2f
Switch to Docker Build action to bypass API calls
TheJaeger Sep 10, 2024
d15fb44
Fix Docker login
TheJaeger Sep 10, 2024
7c7ffa8
Fix incorrect pointer to file location
TheJaeger Sep 10, 2024
6f7635c
Disable GHA caching
TheJaeger Sep 10, 2024
1aa8cca
Revert to non-cached building
TheJaeger Sep 10, 2024
5b9e77e
Fix pytest container name
TheJaeger Sep 10, 2024
5431eb6
Refine cleanup
TheJaeger Sep 10, 2024
08fe879
Add code coverage summary
TheJaeger Sep 10, 2024
b2e23f9
Add cov PR comment
TheJaeger Sep 10, 2024
e0c85e6
Pre-commit autofix
TheJaeger Sep 10, 2024
ac3058d
Add test summary
TheJaeger Sep 10, 2024
ca40b20
Fix path to test result
TheJaeger Sep 10, 2024
f350b5b
Rework models.py and introduce unit tests
TheJaeger Sep 10, 2024
fc41bb6
Remove redundancy in models.py
TheJaeger Sep 10, 2024
091da06
Pre-commit autofix
TheJaeger Sep 10, 2024
0ae2a99
Add more tests
TheJaeger Sep 11, 2024
ac13dcd
Merge remote-tracking branch 'origin/feature/project-overhaul-2' into…
TheJaeger Sep 11, 2024
bbdb1ce
Linting
TheJaeger Sep 11, 2024
8f24668
Save tests and code changes [WIP]
TheJaeger Sep 11, 2024
6972cdb
Linting
TheJaeger Sep 11, 2024
d013c26
Split summary-report into a separate step
TheJaeger Sep 12, 2024
dd8be94
Force summary-report run
TheJaeger Sep 12, 2024
094f115
Fix failing tests
TheJaeger Sep 12, 2024
f95bf6e
Update mrgrid test file
TheJaeger Sep 17, 2024
2b3ca8e
Add distributed unit testing - xdist
TheJaeger Sep 17, 2024
022d214
Fix ref to API docs
TheJaeger Sep 17, 2024
973f66c
Add some big tests
TheJaeger Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/neurodock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Docker Build and Publish

on:
push:
branches:
- master
tags:
- "**"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_BRIDGE_PAT }}

- name: Fetch version
id: version
uses: SebRollen/[email protected]
with:
file: 'pyproject.toml'
field: 'tool.poetry.version'

- name: Setup QEMU
id: qemu
uses: docker/setup-qemu-action@v3

- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
id: login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build_push
uses: docker/build-push-action@v5
with:
push: true
tags: |
dmri/neurodock:latest
dmri/neurodock:${{ steps.version.outputs.value }}
ghcr.io/muscbridge/PyDesigner:latest
ghcr.io/muscbridge/PyDesigner:${{ steps.version.outputs.value }}
39 changes: 0 additions & 39 deletions .github/workflows/pydesigner_build.yml

This file was deleted.

138 changes: 126 additions & 12 deletions .github/workflows/pydesigner_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,140 @@ name: CI
on:
pull_request:
push:
branches: [main]
branches: master
tags:
- "**"
permissions:
checks: write
pull-requests: write


jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_BRIDGE_PAT }}

- name: Set up Python
uses: actions/setup-python@v3
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.12
architecture: 'x64'

- name: Run Pre-Commit
id: pre-commit
uses: pre-commit/[email protected]
continue-on-error: true
with:
pre-commit_version: latest
python_version: 3.8
system: true
# - name: Auto-commit changed files
# uses: stefanzweifel/git-auto-commit-action@v5
# with:
# commit_message: "Pre-commit fixes"


extra_args: --all-files

- name: Auto-commit changed files
id: git-auto-commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Pre-commit autofix"

- name: Return pre-commit response
if: steps.pre-commit.outcome == 'failure'
run: exit 1

pytest:
needs: pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BRIDGE_PAT }}

- name: Login to Docker Hub
id: login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker image
run: docker build -t pydesigner-test -f tests/Dockerfile .

- name: Run tests in Docker container
run: docker run --name pydesigner-test-container pydesigner-test

- name: Copy test results
if: always()
run: docker cp pydesigner-test-container:/test_results/ ./test_results

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: ./test_results/results.xml

- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./test_results/coverage.xml

- name: Clean up
run: |
docker container rm pydesigner-test-container
docker image rm pydesigner-test

summary-reports:
needs: pytest
if: always()
runs-on: ubuntu-latest
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_BRIDGE_PAT }}

- name: Download test results
uses: actions/download-artifact@v4
with:
name: test-results
path: ./test_results

- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: ./test_results

- name: Code coverage summary report
uses: irongut/[email protected]
with:
filename: ./test_results/coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '10 50'

- name: Publish Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md

- name: Output Coverage to Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: |
test_results/results.xml
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Folders to ignore
.coverage*
.idea/
__pycache__/
.ipynb_checkpoints/
Expand All @@ -13,6 +14,8 @@ docs/html/
docs/doctrees/

# Files to ignore
.DS_Store
**.DS_Store
**._.
**._./
designer/._DESIGNER.py
.nii
25 changes: 15 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.5.0'
rev: 'v4.6.0'
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: '0.27.0'
rev: '0.29.2'
hooks:
- id: check-readthedocs

Expand All @@ -18,20 +18,25 @@ repos:
args: ['--html-dir', 'docs/html', '--source-dir', 'docs/source']
language_version: python3

- repo: https://github.com/psf/black
rev: '23.9.1'
hooks:
- id: black
# - repo: https://github.com/psf/black
# rev: '24.4.2'
# hooks:
# - id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.0'
rev: 'v0.6.4'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--config, pyproject.toml, --fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/python-poetry/poetry
rev: '1.6.0'
rev: '1.8.0'
hooks:
- id: poetry-lock
args: ["--no-update"]
- id: poetry-check
# - id: poetry-lock
- id: poetry-export
args: ["--without-hashes", "-f", "requirements.txt", "-o", "requirements.txt"]
- id: poetry-export
args: ["--without-hashes", "--only", "dev", "-f", "requirements.txt", "-o", "requirements-dev.txt"]
Loading
Loading