-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features: - test: enhance test and coverage configuration - Add pytest configuration in pyproject.toml - Configure coverage settings and reporting - Update CI pipeline for coverage tracking Bug Fixes: - fix: set SMPS default size range (11.8, 593.5) - Add kwargs to RawDataReader for customizable size range Improvements: - refactor(logger): enhance progress bar visualization and formatting - refactor: improve code syntax and structure - ci: optimize project configuration and build workflows - Streamline CI/CD pipeline - Resolve artifact naming conflicts - docs: update project documentation This release focuses on improving test coverage, fixing SMPS size range configuration, enhancing system visualization, and optimizing project infrastructure.
- Loading branch information
1 parent
b3f9531
commit c7cae9b
Showing
31 changed files
with
780 additions
and
441 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,103 @@ | ||
# .gitHub/workflows/cleanup.yml | ||
name: Cleanup Deployments | ||
# .github/workflows/cleanup.yml | ||
name: Repository Cleanup | ||
|
||
on: | ||
workflow_dispatch: # 允許手動觸發 | ||
workflow_dispatch: | ||
inputs: | ||
action_type: | ||
description: '選擇要執行的操作' | ||
required: true | ||
type: choice | ||
options: | ||
- 'Cleanup Workflow' | ||
- 'Cleanup Deployments' | ||
workflow_status: | ||
description: '要清理的工作流程狀態 (僅在選擇 Cleanup Workflow 時需要)' | ||
required: false | ||
type: choice | ||
options: | ||
- 'disabled' # 已停用的工作流程 | ||
- 'active' # 活躍的工作流程 | ||
- 'all' # 所有工作流程 | ||
environment: | ||
description: '要清理的部署環境 (僅在選擇 Cleanup Deployments 時需要)' | ||
required: false | ||
type: choice | ||
options: | ||
- 'all' | ||
- 'github-pages' | ||
- 'pypi' | ||
|
||
jobs: | ||
cleanup: | ||
cleanup-workflows: | ||
if: ${{ github.event.inputs.action_type == 'Cleanup Workflow' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
steps: | ||
- name: Cleanup workflows | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const status = '${{ github.event.inputs.workflow_status }}'; | ||
console.log(`Cleaning up workflows with status: ${status}`); | ||
// 獲取所有工作流程 | ||
const workflows = await github.rest.actions.listRepoWorkflows({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
for (const workflow of workflows.data.workflows) { | ||
// 根據選擇的狀態過濾工作流程 | ||
if (status === 'all' || | ||
(status === 'disabled' && !workflow.state === 'active') || | ||
(status === 'active' && workflow.state === 'active')) { | ||
console.log(`Processing workflow: ${workflow.name} (${workflow.state})`); | ||
// 獲取此工作流程的所有運行 | ||
const runs = await github.rest.actions.listWorkflowRuns({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
workflow_id: workflow.id, | ||
}); | ||
// 刪除運行 | ||
console.log(`Found ${runs.data.total_count} runs to delete`); | ||
for (const run of runs.data.workflow_runs) { | ||
console.log(`Deleting run #${run.run_number} of ${workflow.name}`); | ||
await github.rest.actions.deleteWorkflowRun({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: run.id | ||
}); | ||
} | ||
} | ||
} | ||
console.log('Cleanup completed'); | ||
cleanup-deployments: | ||
if: ${{ github.event.inputs.action_type == 'Cleanup Deployments' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
deployments: write | ||
actions: write | ||
contents: write | ||
|
||
steps: | ||
- name: Delete github-pages deployments | ||
if: ${{ github.event.inputs.environment == 'github-pages' || github.event.inputs.environment == 'all' }} | ||
uses: strumwolf/delete-deployment-environment@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
environment: github-pages | ||
onlyRemoveDeployments: true | ||
|
||
- name: Delete pypi deployments | ||
if: ${{ github.event.inputs.environment == 'pypi' || github.event.inputs.environment == 'all' }} | ||
uses: strumwolf/delete-deployment-environment@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
environment: pypi | ||
onlyRemoveDeployments: true | ||
onlyRemoveDeployments: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,135 @@ | ||
# .gitHub/workflows/publish.yml | ||
name: Publish to PyPI | ||
name: Publish AeroViz | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # 當推送版本標籤時觸發,如 v0.1.0 | ||
- 'v*' | ||
|
||
jobs: | ||
build-and-publish: | ||
build-and-test: | ||
strategy: | ||
matrix: | ||
python-version: [ "3.11", "3.12" ] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel build twine | ||
pip install setuptools wheel build | ||
pip install -e . | ||
pip install -e ".[test]" | ||
- name: Extract version from tag | ||
id: get_version | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | ||
- name: Run tests | ||
run: | | ||
pytest tests/ -m "not requires_data" | ||
- name: Verify version matches | ||
- name: Verify package version matches tag | ||
run: | | ||
VERSION=$(python setup.py --version) | ||
if [ "$VERSION" != "${{ env.VERSION }}" ]; then | ||
echo "Version mismatch: Tag version (${{ env.VERSION }}) doesn't match package version ($VERSION)" | ||
TAG_VERSION=${GITHUB_REF#refs/tags/v} | ||
PACKAGE_VERSION=$(python setup.py --version) | ||
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then | ||
echo "Version mismatch:" | ||
echo " - Tag version: $TAG_VERSION" | ||
echo " - Package version: $PACKAGE_VERSION" | ||
exit 1 | ||
else | ||
echo "Version match: $TAG_VERSION" | ||
fi | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Publish to Test PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | ||
run: | | ||
twine upload --repository testpypi dist/* | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions-${{ matrix.python-version }} | ||
path: dist/ | ||
|
||
publish-test: | ||
needs: build-and-test | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: test-pypi | ||
url: https://test.pypi.org/p/AeroViz | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
# Download artifacts from Python 3.12 build only | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions-3.12 | ||
path: dist/ | ||
|
||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
publish-prod: | ||
needs: publish-test | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/AeroViz | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions-3.12 | ||
path: dist/ | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
name: Create GitHub Release | ||
needs: publish-prod | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions-3.12 | ||
path: dist/ | ||
|
||
- name: Sign the dists with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Create GitHub Release | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
twine upload dist/* | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes "Release ${{ github.ref_name }}" | ||
- name: Upload artifacts to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' |
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
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
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
File renamed without changes.
Oops, something went wrong.