-
Notifications
You must be signed in to change notification settings - Fork 1
bug fixes for new features #47
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,7 +38,16 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| - name: Generate Version | ||||||||||||||||||||||||||||||||||||||||||
| id: version | ||||||||||||||||||||||||||||||||||||||||||
| run: python .github/scripts/generate_release_version.py --type ${{ github.event.inputs.release_type }} | ||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||
| VERSION=$(python .github/scripts/generate_release_version.py --type ${{ github.event.inputs.release_type }}) | ||||||||||||||||||||||||||||||||||||||||||
| # Fallback to 2026.1.2 if version generation fails or returns invalid version | ||||||||||||||||||||||||||||||||||||||||||
| if [ -z "$VERSION" ] || [ "$VERSION" = "0.0.0" ] || ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then | ||||||||||||||||||||||||||||||||||||||||||
| echo "Warning: Version generation failed or returned invalid version '$VERSION', using fallback: 2026.1.2" | ||||||||||||||||||||||||||||||||||||||||||
| VERSION="2026.1.2" | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||
| echo "is_prerelease=${{ github.event.inputs.release_type != 'stable' }}" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||
| echo "Generated version: $VERSION" | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+41
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tighten the version regex so malformed versions don’t bypass the fallback. The current pattern only checks a prefix, so values like 🛠️ Suggested fix- if [ -z "$VERSION" ] || [ "$VERSION" = "0.0.0" ] || ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then
+ if [ -z "$VERSION" ] || [ "$VERSION" = "0.0.0" ] || ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'; then📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| - name: Update Version in Files | ||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -139,8 +148,11 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| PATCH=$(echo $VERSION | cut -d. -f3) | ||||||||||||||||||||||||||||||||||||||||||
| NEXT_PATCH=$((PATCH + 1)) | ||||||||||||||||||||||||||||||||||||||||||
| DEV_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}-dev" | ||||||||||||||||||||||||||||||||||||||||||
| # Use release version as fallback (without -dev suffix) | ||||||||||||||||||||||||||||||||||||||||||
| FALLBACK_VERSION="${MAJOR}.${MINOR}.${PATCH}" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| echo "Setting development version to $DEV_VERSION" | ||||||||||||||||||||||||||||||||||||||||||
| echo "Updating fallback versions to $FALLBACK_VERSION" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # Update version files | ||||||||||||||||||||||||||||||||||||||||||
| sed -i "s/version = \".*\"/version = \"$DEV_VERSION\"/" pyproject.toml | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -154,9 +166,17 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| sed -i "s/#define MyAppVersion \".*\"/#define MyAppVersion \"$BASE_VERSION\"/" switchcraft_legacy.iss | ||||||||||||||||||||||||||||||||||||||||||
| sed -i "s/#define MyAppVersionNumeric \".*\"/#define MyAppVersionNumeric \"$BASE_VERSION\"/" switchcraft_legacy.iss | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # Update fallback versions in build scripts and version generator | ||||||||||||||||||||||||||||||||||||||||||
| # Update build_release.ps1 fallback | ||||||||||||||||||||||||||||||||||||||||||
| sed -i "s/\$AppVersion = \".*\"/\$AppVersion = \"$FALLBACK_VERSION\"/" scripts/build_release.ps1 | ||||||||||||||||||||||||||||||||||||||||||
| sed -i "s/\$AppVersionNumeric = \".*\"/\$AppVersionNumeric = \"$FALLBACK_VERSION\"/" scripts/build_release.ps1 | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # Update generate_release_version.py fallback | ||||||||||||||||||||||||||||||||||||||||||
| sed -i "s/FALLBACK_VERSION = \".*\"/FALLBACK_VERSION = \"$FALLBACK_VERSION\"/" .github/scripts/generate_release_version.py | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # Commit | ||||||||||||||||||||||||||||||||||||||||||
| git add pyproject.toml src/switchcraft/__init__.py file_version_info.txt switchcraft_modern.iss switchcraft_legacy.iss | ||||||||||||||||||||||||||||||||||||||||||
| git commit -m "chore: bump version to $DEV_VERSION for development [skip ci]" | ||||||||||||||||||||||||||||||||||||||||||
| git add pyproject.toml src/switchcraft/__init__.py file_version_info.txt switchcraft_modern.iss switchcraft_legacy.iss scripts/build_release.ps1 .github/scripts/generate_release_version.py | ||||||||||||||||||||||||||||||||||||||||||
| git commit -m "chore: bump version to $DEV_VERSION and update fallback versions to $FALLBACK_VERSION [skip ci]" | ||||||||||||||||||||||||||||||||||||||||||
| git push origin main | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,12 +10,17 @@ on: | |
| jobs: | ||
| test-backend: | ||
| runs-on: windows-latest | ||
| if: inputs.component == 'backend' | ||
| if: | | ||
| inputs.component == 'backend' && | ||
| ( | ||
| matrix.python-version == '3.14' || | ||
| (matrix.python-version == '3.15' && github.event_name == 'push' && github.ref == 'refs/heads/main') | ||
| ) | ||
| strategy: | ||
| fail-fast: true | ||
| max-parallel: 1 | ||
| matrix: | ||
| python-version: ["3.13", "3.14"] | ||
| python-version: ["3.14", "3.15"] | ||
|
Comment on lines
+13
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The To conditionally run specific matrix combinations, use 🔧 Suggested fix using step-level conditions test-backend:
runs-on: windows-latest
- if: |
- inputs.component == 'backend' &&
- (
- matrix.python-version == '3.14' ||
- (matrix.python-version == '3.15' && github.event_name == 'push' && github.ref == 'refs/heads/main')
- )
+ if: inputs.component == 'backend'
strategy:
fail-fast: true
max-parallel: 1
matrix:
python-version: ["3.14", "3.15"]
+ exclude:
+ - python-version: "3.15"
+ include:
+ - python-version: "3.15"
+ run-condition: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}Alternatively, add a step-level condition to skip steps for Python 3.15 on non-main pushes: - name: Run All Python Tests
if: matrix.python-version == '3.14' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
run: |
pytest tests/ -v --tb=short🧰 Tools🪛 actionlint (1.7.10)15-15: context "matrix" is not allowed here. available contexts are "github", "inputs", "needs", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details (expression) 16-16: context "matrix" is not allowed here. available contexts are "github", "inputs", "needs", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details (expression) 🤖 Prompt for AI Agents |
||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
@@ -35,6 +40,8 @@ jobs: | |
| pytest tests/ -v --tb=short | ||
| env: | ||
| PYTHONPATH: ${{ github.workspace }}/src | ||
| CI: true | ||
| GITHUB_ACTIONS: true | ||
|
|
||
| test-cli-core: | ||
| runs-on: windows-latest | ||
|
|
@@ -45,7 +52,7 @@ jobs: | |
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.13" | ||
| python-version: "3.14" | ||
|
|
||
| - name: Install Core (No GUI) | ||
| run: | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {} |
This file was deleted.
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.
🧩 Analysis chain
🌐 Web query:
GitHub Actions job level if condition matrix context available documentation💡 Result:
Short answer: You cannot use the matrix context inside a job-level if because GitHub Actions evaluates jobs.<job_id>.if before applying the job's strategy.matrix; the matrix is therefore unavailable at that level. Use a step-level if (steps can see matrix), or move the conditional into the matrix definition (include/exclude) or use a preceding job to set outputs and gate the job with needs. [1][2]
Sources:
References:
[1] https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
[2] https://docs.github.com/en/actions/reference/accessing-contextual-information-about-workflow-runs
🌐 Web query:
actions/setup-python@v6 Python 3.15 support ubuntu windows latest💡 Result:
Short answer: Yes — actions/setup-python@v6 can install Python 3.15 on both ubuntu-latest and windows-latest, but as of Jan 16, 2026 Python 3.15 is still a prerelease (alpha) and therefore not guaranteed to be present in the runners' tool cache. Use the action's allow-prereleases option (or specify an exact prerelease build) so the action will fall back to/download the prerelease from releases if it's not cached.
How to (example):
with:
python-version: '3.15'
allow-prereleases: true
Sources:
Fix job-level
ifthat referencesmatrix, and configure prerelease support for Python 3.15.matrixcontext isn't available in job-levelif(it's evaluated before strategy.matrix is applied), so this condition is invalid and will cause the job to be skipped or rejected. Split the 3.15 run into a separate job gated bygithub.*, or move the condition into step-level guards.Additionally, Python 3.15 is currently a prerelease (alpha as of January 2026) and won't be available in the runner tool cache without explicit prerelease support. Add
allow-prereleases: trueto the setup-python action, or this will fail at runtime.🔧 Minimal patch (then add a separate 3.15 job)
For the separate 3.15 job (or when re-adding 3.15 to this matrix), use:
🧰 Tools
🪛 actionlint (1.7.10)
29-29: context "matrix" is not allowed here. available contexts are "github", "inputs", "needs", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details
(expression)
30-30: context "matrix" is not allowed here. available contexts are "github", "inputs", "needs", "vars". see https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability for more details
(expression)
🤖 Prompt for AI Agents