Skip to content

Commit 3574fc0

Browse files
committed
Initial commit
0 parents  commit 3574fc0

238 files changed

Lines changed: 49792 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coverage-config

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[run]
2+
branch = True
3+
source_pkgs =
4+
moldflow
5+
6+
[paths]
7+
source =
8+
src/moldflow
9+
*/site-packages/moldflow
10+
11+
[report]
12+
fail_under = 93
13+
show_missing = True
14+
precision = 2
15+
16+
[html]
17+
title = Moldflow API Unit Test Coverage
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Import '...'
16+
2. Call function '....'
17+
3. With parameters '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Error Message**
24+
If applicable, add the full error message or stack trace.
25+
26+
**Environment:**
27+
- OS: [e.g. Windows 10]
28+
- Python Version: [e.g. 3.10.5]
29+
- Package Version: [e.g. 26.0.1]
30+
- Moldflow Synergy Version: [e.g. 2026.1]
31+
32+
**Additional context**
33+
Add any other context about the problem here.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**API Design (if applicable)**
20+
```python
21+
# Example of how you'd like to use this feature
22+
from moldflow import Synergy
23+
24+
synergy = Synergy()
25+
# Your proposed API usage here
26+
```
27+
28+
**Additional context**
29+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Description
2+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
3+
4+
Fixes # (issue)
5+
6+
## Type of change
7+
Please delete options that are not relevant.
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] Documentation update
13+
14+
## Checklist
15+
Please delete options that are not relevant.
16+
17+
- [ ] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document
18+
- [ ] My code follows the style guidelines of this project
19+
- [ ] I have added tests that prove my fix is effective or that my feature works
20+
- [ ] New and existing unit tests pass locally with my changes
21+
- [ ] I have updated the documentation accordingly
22+
- [ ] I have added a note to CHANGELOG.md describing my changes
23+
- [ ] My changes generate no new warnings
24+
- [ ] Any dependent changes have been merged and published
25+
26+
## Testing
27+
Please describe the tests that you ran to verify your changes.
28+
29+
```python
30+
# Example test code
31+
def test_my_feature():
32+
synergy = Synergy()
33+
result = synergy.my_feature()
34+
assert result == expected_value
35+
```
36+
37+
## Additional Notes
38+
Add any other context about the pull request here.

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types: [ published ]
8+
9+
jobs:
10+
test:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [windows-2022]
15+
python-version: ['3.10', '3.11', '3.12', '3.13']
16+
17+
steps:
18+
- uses: actions/checkout@v5
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install -r requirements.txt
29+
30+
- name: SPDX headers check (check-only)
31+
run: python scripts/check_spdx.py --check-only
32+
33+
- name: Localization check
34+
run: python scripts/check_localization.py --check-only --path src/moldflow --locale-path src/moldflow/locale
35+
36+
- name: Build package
37+
run: python run.py build --install
38+
39+
- name: Run linting
40+
run: python run.py lint --skip-build
41+
42+
- name: Run tests
43+
run: python run.py test --skip-build --keep-files --quiet
44+
45+
- name: Generate coverage report
46+
run: python run.py report --cli
47+
48+
build-docs:
49+
runs-on: windows-2022
50+
needs: test
51+
52+
steps:
53+
- uses: actions/checkout@v5
54+
55+
- name: Set up Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: '3.13'
59+
60+
- name: Install dependencies
61+
run: |
62+
python -m pip install --upgrade pip
63+
python -m pip install -r requirements.txt
64+
65+
- name: Build documentation
66+
run: python run.py build-docs

.github/workflows/publish.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Publish package (manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
confirm:
7+
description: "Confirm publish package"
8+
required: true
9+
type: boolean
10+
11+
jobs:
12+
guard-ci-success:
13+
runs-on: windows-2022
14+
permissions:
15+
contents: read
16+
statuses: read
17+
actions: read
18+
steps:
19+
- name: Ensure CI for this commit succeeded
20+
shell: pwsh
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
$ownerRepo = $env:GITHUB_REPOSITORY
25+
$sha = $env:GITHUB_SHA
26+
$headers = @{
27+
Authorization = "token $env:GITHUB_TOKEN"
28+
Accept = 'application/vnd.github+json'
29+
'X-GitHub-Api-Version' = '2022-11-28'
30+
}
31+
32+
# Query specific CI workflow runs and require a successful run for this commit
33+
$workflow = 'ci.yml'
34+
$branch = $env:GITHUB_REF_NAME
35+
$url = "https://api.github.com/repos/$ownerRepo/actions/workflows/$workflow/runs?branch=$branch&per_page=20"
36+
37+
try {
38+
$resp = Invoke-RestMethod -Method Get -Uri $url -Headers $headers -ErrorAction Stop
39+
} catch {
40+
Write-Error "Blocking publish: failed to query CI workflow runs ($($_.Exception.Message))"
41+
exit 1
42+
}
43+
44+
if (-not $resp.workflow_runs) {
45+
Write-Error "Blocking publish: no CI runs found on branch '$branch'"
46+
exit 1
47+
}
48+
49+
$matching = $resp.workflow_runs | Where-Object { $_.head_sha -eq $sha -and $_.status -eq 'completed' }
50+
if (-not $matching) {
51+
Write-Error "Blocking publish: no completed CI run found for commit $sha"
52+
exit 1
53+
}
54+
55+
$success = $matching | Where-Object { $_.conclusion -eq 'success' } | Select-Object -First 1
56+
if (-not $success) {
57+
$concl = ($matching | Select-Object -First 1).conclusion
58+
Write-Error "Blocking publish: CI conclusion for $sha is '$concl'"
59+
exit 1
60+
}
61+
62+
build-and-publish:
63+
needs: guard-ci-success
64+
if: ${{ github.event.inputs.confirm == 'true' && startsWith(github.ref_name, 'release/') }}
65+
runs-on: windows-2022
66+
permissions:
67+
contents: write
68+
pages: write
69+
id-token: write
70+
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v5
74+
75+
- name: Set up Python
76+
uses: actions/setup-python@v5
77+
with:
78+
python-version: '3.13'
79+
80+
- name: Check if version exists on PyPI
81+
id: pypi_check
82+
shell: pwsh
83+
run: |
84+
$packageName = 'moldflow'
85+
86+
try {
87+
$resp = Invoke-WebRequest -Uri "https://test.pypi.org/pypi/$packageName/json" -UseBasicParsing -ErrorAction Stop
88+
$data = $resp.Content | ConvertFrom-Json
89+
$versions = @($data.releases.PSObject.Properties.Name)
90+
} catch {
91+
$versions = @()
92+
}
93+
94+
$versionJson = Get-Content -Raw -Path version.json | ConvertFrom-Json
95+
$patch = if ($env:BUILD_NUMBER) { $env:BUILD_NUMBER } else { "$($versionJson.patch)" }
96+
$version = "$($versionJson.major).$($versionJson.minor).$patch"
97+
$exists = if ($versions -contains $version) { 'true' } else { 'false' }
98+
Write-Output "Release $version exists on PyPI: $exists"
99+
"exists=$exists" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
100+
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
101+
102+
- name: Skip publish, version already exists
103+
if: steps.pypi_check.outputs.exists == 'true'
104+
run: Write-Output "Version ${{ steps.pypi_check.outputs.version }} already exists on PyPI. Skipping publish."
105+
106+
- name: Install build dependencies
107+
if: steps.pypi_check.outputs.exists == 'false'
108+
run: |
109+
python -m pip install --upgrade pip
110+
pip install -r requirements.txt
111+
112+
- name: Build package
113+
if: steps.pypi_check.outputs.exists == 'false'
114+
run: |
115+
python run.py build
116+
117+
- name: Publish to PyPI
118+
if: steps.pypi_check.outputs.exists == 'false'
119+
env:
120+
TWINE_USERNAME: __token__
121+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
122+
run: |
123+
python run.py publish --skip-build --testpypi
124+
125+
- name: Create GitHub Release
126+
if: steps.pypi_check.outputs.exists == 'false'
127+
run: |
128+
python run.py release
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
132+
- name: Configure Pages
133+
uses: actions/configure-pages@v5
134+
135+
- name: Build documentation
136+
run: python run.py build-docs
137+
138+
- name: Upload Pages artifact
139+
uses: actions/upload-pages-artifact@v4
140+
with:
141+
path: ./docs/build/html
142+
143+
- name: Deploy to GitHub Pages
144+
id: deployment
145+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)