-
Notifications
You must be signed in to change notification settings - Fork 0
add nbmake dependency and run in CI #22
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
Changes from 5 commits
3e9e4b1
0ca9b87
3607c32
3069836
6059e09
28bb5a6
f4eebea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,4 @@ | ||||||||||||||||||||||||||||||||||||
| name: Test and build | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||
| branches: [main] | ||||||||||||||||||||||||||||||||||||
|
|
@@ -9,30 +8,96 @@ on: | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||
| test: | ||||||||||||||||||||||||||||||||||||
| runs-on: ${{matrix.os}} | ||||||||||||||||||||||||||||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||||||
| os: | ||||||||||||||||||||||||||||||||||||
| - ubuntu-latest | ||||||||||||||||||||||||||||||||||||
| - windows-latest | ||||||||||||||||||||||||||||||||||||
| - macos-latest | ||||||||||||||||||||||||||||||||||||
| python-version: ['3.14'] | ||||||||||||||||||||||||||||||||||||
| include: | ||||||||||||||||||||||||||||||||||||
| - os: ubuntu-latest | ||||||||||||||||||||||||||||||||||||
| python-version: '3.14' | ||||||||||||||||||||||||||||||||||||
| muse2_asset: muse2_linux.tar.gz | ||||||||||||||||||||||||||||||||||||
| muse2_exe: muse2 | ||||||||||||||||||||||||||||||||||||
| - os: windows-latest | ||||||||||||||||||||||||||||||||||||
| python-version: '3.14' | ||||||||||||||||||||||||||||||||||||
| muse2_asset: muse2_windows.zip | ||||||||||||||||||||||||||||||||||||
| muse2_exe: muse2.exe | ||||||||||||||||||||||||||||||||||||
| - os: macos-latest | ||||||||||||||||||||||||||||||||||||
| python-version: '3.14' | ||||||||||||||||||||||||||||||||||||
| muse2_asset: muse2_macos_arm.tar.gz | ||||||||||||||||||||||||||||||||||||
| muse2_exe: muse2 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v6 | ||||||||||||||||||||||||||||||||||||
| - uses: astral-sh/setup-uv@v7 | ||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - uses: astral-sh/setup-uv@v5 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| enable-cache: true | ||||||||||||||||||||||||||||||||||||
| prune-cache: false | ||||||||||||||||||||||||||||||||||||
| activate-environment: true | ||||||||||||||||||||||||||||||||||||
|
Aurashk marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||
| python-version: ${{ matrix.python-version }} | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||||||||
| run: uv sync | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # Query the GitHub API for the latest MUSE2 release tag (e.g. "v2.0.0"). | ||||||||||||||||||||||||||||||||||||
| # The tag is written to GITHUB_OUTPUT so subsequent steps can reference it. | ||||||||||||||||||||||||||||||||||||
| - name: Get latest MUSE2 release tag | ||||||||||||||||||||||||||||||||||||
| id: muse2_release | ||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||
| TAG=$(curl -sSf \ | ||||||||||||||||||||||||||||||||||||
| -H "Accept: application/vnd.github+json" \ | ||||||||||||||||||||||||||||||||||||
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||||||||||||||||||||||||||||||||||||
|
Aurashk marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||||||||
| https://api.github.com/repos/EnergySystemsModellingLab/MUSE2/releases/latest \ | ||||||||||||||||||||||||||||||||||||
| | jq -r '.tag_name') | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
+52
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| if [[ -z "$TAG" || "$TAG" == "null" ]]; then | ||||||||||||||||||||||||||||||||||||
| echo "::error::Failed to retrieve latest MUSE2 release tag." | ||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| echo "Resolved latest MUSE2 release: $TAG" | ||||||||||||||||||||||||||||||||||||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # Download the platform-appropriate MUSE2 release asset. | ||||||||||||||||||||||||||||||||||||
| # 'shell: bash' is used on all platforms | ||||||||||||||||||||||||||||||||||||
| - name: Download MUSE2 release asset | ||||||||||||||||||||||||||||||||||||
| shell: bash | ||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||
| curl -sSfL \ | ||||||||||||||||||||||||||||||||||||
| "https://github.com/EnergySystemsModellingLab/MUSE2/releases/download/${{ steps.muse2_release.outputs.tag }}/${{ matrix.muse2_asset }}" \ | ||||||||||||||||||||||||||||||||||||
| --output "muse2_asset_download" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
Comment on lines
+67
to
+70
|
||||||||||||||||||||||||||||||||||||
| curl -sSfL \ | |
| "https://github.com/EnergySystemsModellingLab/MUSE2/releases/download/${{ steps.muse2_release.outputs.tag }}/${{ matrix.muse2_asset }}" \ | |
| --output "muse2_asset_download" | |
| set -euo pipefail | |
| ASSET_URL="https://github.com/EnergySystemsModellingLab/MUSE2/releases/download/${{ steps.muse2_release.outputs.tag }}/${{ matrix.muse2_asset }}" | |
| CHECKSUM_URL="${ASSET_URL}.sha256" | |
| echo "Downloading MUSE2 asset from: ${ASSET_URL}" | |
| curl -sSfL "${ASSET_URL}" --output "muse2_asset_download" | |
| echo "Downloading MUSE2 asset checksum from: ${CHECKSUM_URL}" | |
| curl -sSfL "${CHECKSUM_URL}" --output "muse2_asset_download.sha256" | |
| echo "Verifying checksum for downloaded MUSE2 asset..." | |
| sha256sum -c "muse2_asset_download.sha256" | |
| echo "MUSE2 asset checksum verification succeeded." |
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify MUSE2 installation uses shell: bash on all OSes, but on Windows MUSE2_PATH is written as a Windows path with backslashes (e.g. C:\...). Bash file tests can behave inconsistently with Windows-style paths depending on the runner shell. Consider making this step OS-specific (use pwsh on Windows) or normalizing the path (e.g. via cygpath) before testing it to avoid false negatives.
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow calls mypy/pytest directly after uv sync. Unless the virtual environment is explicitly activated by setup-uv, those executables may not be on PATH (README suggests using uv run or activating .venv). Consider running these as uv run mypy . / uv run pytest --nbmake, or re-enabling environment activation in the setup-uv step if supported, to make the workflow robust across runner shells/OSes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add this flag to the other pytest options in pyproject.toml. But maybe we want to keep it as a separate option if it's somewhat long-running. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a good idea, for now it's instant. We can always separate the notebook testing later on if we need to.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ dev = [ | |
| "pytest>=9.0.2", | ||
| "pytest-cov>=7.0.0", | ||
| "pytest-mock>=3.15.1", | ||
| "nbmake>=1.5.5", | ||
| ] | ||
|
|
||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.