-
Notifications
You must be signed in to change notification settings - Fork 0
Claude/dependabot updates counter risk j z8vg #335
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 6 commits
a952e23
5ad86b3
5f7b877
1a18063
024b809
397abe1
0af4644
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 |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # Builds a versioned Windows operator bundle using PyInstaller. | ||
| # Downloads the artifact from the GitHub Actions run summary page. | ||
| # | ||
| # Trigger modes: | ||
| # - Manual dispatch (workflow_dispatch) | ||
| # - Push of a version tag (e.g. v0.1.0) | ||
|
|
||
| name: Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: "Branch, tag, or SHA to build from (defaults to the current branch)" | ||
| required: false | ||
| default: "" | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-windows: | ||
| name: Build Windows bundle | ||
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install -e ".[dev]" | ||
|
|
||
| - name: Read version | ||
| id: version | ||
| shell: bash | ||
| run: echo "version=$(cat VERSION | tr -d '\r\n')" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Build executable with PyInstaller | ||
| run: pyinstaller -y release.spec | ||
|
|
||
| - name: Assemble release bundle | ||
| run: > | ||
| python -m counter_risk.build.release | ||
| --version-file VERSION | ||
| --output-dir release | ||
| --force | ||
|
|
||
|
||
| - name: Verify bundle contents | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| VERSION="${{ steps.version.outputs.version }}" | ||
| BUNDLE="release/${VERSION}" | ||
| for path in \ | ||
| "${BUNDLE}/VERSION" \ | ||
| "${BUNDLE}/manifest.json" \ | ||
| "${BUNDLE}/counter_risk_runner.xlsm" \ | ||
| "${BUNDLE}/run_counter_risk.cmd" \ | ||
| "${BUNDLE}/request_counter_risk_remote.cmd" \ | ||
| "${BUNDLE}/process_counter_risk_remote.cmd" \ | ||
| "${BUNDLE}/remote_trigger_testing.md" \ | ||
| "${BUNDLE}/README_HOW_TO_RUN.md" \ | ||
| "${BUNDLE}/bin/counter-risk.exe" | ||
| do | ||
| if [ ! -e "$path" ]; then | ||
| echo "MISSING: $path" && exit 1 | ||
| fi | ||
| echo "OK: $path" | ||
| done | ||
|
|
||
| - name: Upload bundle artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: counter-risk-${{ steps.version.outputs.version }}-windows | ||
| path: release/${{ steps.version.outputs.version }}/ | ||
| if-no-files-found: error | ||
| retention-days: 30 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |
| from datetime import UTC, datetime | ||
| from pathlib import Path | ||
|
|
||
| from counter_risk.build.xlsm import build_xlsm_artifact | ||
|
|
||
| RELEASE_NAME_PREFIX = "counter-risk" | ||
| EXECUTABLE_BASENAME = "counter-risk" | ||
| LOGGER = logging.getLogger(__name__) | ||
|
|
@@ -94,15 +96,23 @@ def _copy_tree_filtered( | |
| return copied | ||
|
|
||
|
|
||
| def _copy_runner_xlsm(root: Path, bundle_dir: Path) -> list[Path]: | ||
| src = root / "Runner.xlsm" | ||
| if not src.is_file(): | ||
| def _build_runner_xlsm(root: Path, bundle_dir: Path, version: str) -> list[Path]: | ||
| template = root / "assets" / "templates" / "counter_risk_template.xlsm" | ||
| if not template.is_file(): | ||
| raise ValueError( | ||
| f"Required Excel runner not found at '{src}'. " | ||
| "Ensure Runner.xlsm is present in the repository root before building a release." | ||
| f"Required XLSM template not found at '{template}'. " | ||
| "Ensure assets/templates/counter_risk_template.xlsm is present " | ||
| "before building a release." | ||
| ) | ||
|
Comment on lines
+99
to
106
|
||
| dst = bundle_dir / "counter_risk_runner.xlsm" | ||
| shutil.copy2(src, dst) | ||
| run_date = datetime.now(UTC) | ||
| build_xlsm_artifact( | ||
| template_path=template, | ||
| output_path=dst, | ||
| as_of_date=run_date.date(), | ||
| run_date=run_date, | ||
| version=version, | ||
| ) | ||
| return [dst] | ||
|
|
||
|
|
||
|
|
@@ -330,7 +340,7 @@ def assemble_release(version: str, output_dir: Path, *, force: bool = False) -> | |
| bundle_dir.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| copied: dict[str, list[Path]] = {} | ||
| copied["runner_xlsm"] = _copy_runner_xlsm(root, bundle_dir) | ||
| copied["runner_xlsm"] = _build_runner_xlsm(root, bundle_dir, version) | ||
| copied["templates"] = _copy_templates(root, bundle_dir) | ||
| copied["fixtures"] = _copy_fixture_artifacts(root, bundle_dir) | ||
|
|
||
|
|
||
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.
ref: ${{ inputs.ref || github.ref }}is likely invalid in a normal workflow: theinputs.*context is forworkflow_call(reusable workflows), whileworkflow_dispatchinputs are accessed viagithub.event.inputs. As written, this can cause workflow validation errors or ignore the dispatch input. Usegithub.event.inputs.ref(optionally guarded bygithub.event_name == 'workflow_dispatch') and fall back togithub.reffor tag pushes.