-
Notifications
You must be signed in to change notification settings - Fork 0
feat(PLT-1735): golden vector parity — Python side #6
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 15 commits
4ba86e9
267fd1a
18bac84
b797287
c0384a1
02b8981
f079780
8915879
d57d90a
633db5f
e09e0a0
f4e9f22
0c3b7c9
e0e918d
9ce01f6
f256d6c
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 |
|---|---|---|
|
|
@@ -6,17 +6,20 @@ on: | |
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
@@ -30,10 +33,10 @@ jobs: | |
| license-check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --dev | ||
|
|
@@ -47,11 +50,14 @@ jobs: | |
| dependency-review: | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read # required by actions/dependency-review-action to fetch PR diff | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
|
|
||
| - name: Dependency review | ||
| uses: actions/dependency-review-action@v4 | ||
| uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4 | ||
| with: | ||
| deny-licenses: >- | ||
| GPL-2.0-only, GPL-2.0-or-later, | ||
|
|
@@ -60,3 +66,44 @@ jobs: | |
| LGPL-2.0-only, LGPL-2.0-or-later, | ||
| LGPL-2.1-only, LGPL-2.1-or-later, | ||
| LGPL-3.0-only, LGPL-3.0-or-later | ||
|
|
||
| golden-sync-check: | ||
| runs-on: ubuntu-latest | ||
| # Secrets are not available to fork PRs, so skip the check there. | ||
| # Internal PRs and pushes to main always run it. | ||
| if: > | ||
| github.event_name != 'pull_request' || | ||
| github.event.pull_request.head.repo.full_name == github.repository | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
|
Comment on lines
+70
to
+79
Contributor
Author
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. Fixed. Added a job-level |
||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
|
|
||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3 | ||
| with: | ||
| app-id: ${{ secrets.STARFIX_APP_ID }} | ||
| private-key: ${{ secrets.STARFIX_APP_PRIVATE_KEY }} | ||
| repositories: starfix | ||
|
|
||
| - name: Fetch authoritative fixture from starfix | ||
| run: | | ||
| gh api repos/nauticalab/starfix/contents/tests/golden/include_metadata_v0.3.json \ | ||
| --jq '.content' | base64 -d > /tmp/upstream.json | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - name: Fail on fixture drift | ||
| run: | | ||
| if [ ! -s /tmp/upstream.json ]; then | ||
| echo "ERROR: Could not fetch fixture from nauticalab/starfix main." | ||
| echo "Ensure nauticalab/starfix#main has tests/golden/include_metadata_v0.3.json" | ||
| echo "(starfix PLT-1735 PR must be merged before this check can pass)" | ||
| exit 1 | ||
| fi | ||
| if ! diff tests/golden/include_metadata_v0.3.json /tmp/upstream.json; then | ||
| echo "ERROR: tests/golden/include_metadata_v0.3.json has drifted from nauticalab/starfix main." | ||
| echo "Copy the updated fixture from the starfix repo and commit it." | ||
| exit 1 | ||
| fi | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| name: release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Release version (e.g. 0.3.0)' | ||
| required: true | ||
| type: string | ||
|
|
||
| # Minimal default; individual jobs declare only what they need. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test (Python ${{ matrix.python-version }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12"] | ||
| steps: | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| run: uv python install ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync --dev --python ${{ matrix.python-version }} | ||
|
|
||
| - name: Run tests | ||
| run: uv run --python ${{ matrix.python-version }} pytest tests/ -v | ||
|
|
||
| build: | ||
| name: Build distribution | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # required to push the release tag | ||
| outputs: | ||
| version: ${{ steps.normalize.outputs.version }} | ||
| steps: | ||
| # Strip a leading 'v' once here; all downstream steps use the output. | ||
| - name: Normalize version | ||
| id: normalize | ||
| run: | | ||
| VERSION="${{ inputs.version }}" | ||
| VERSION="${VERSION#v}" | ||
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| fetch-depth: 0 # required: hatch-vcs derives the package version from git tags | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Tag release | ||
| run: | | ||
| git tag "v${{ steps.normalize.outputs.version }}" | ||
| git push origin "v${{ steps.normalize.outputs.version }}" | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 | ||
|
|
||
| - name: Build wheel and sdist | ||
| run: uv build | ||
|
Contributor
Author
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. Fixed in commit f256d6c. Split the former 'Tag release' step into two:
|
||
|
|
||
| - name: Upload dist artifact | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| if-no-files-found: error | ||
|
|
||
| publish-testpypi: | ||
| name: Publish → TestPyPI | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: testpypi | ||
| url: https://test.pypi.org/p/starfix | ||
| permissions: | ||
| id-token: write # required for OIDC trusted publishing | ||
| steps: | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 | ||
|
|
||
| - name: Download dist artifact | ||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to TestPyPI | ||
| run: uv publish --publish-url https://test.pypi.org/legacy/ dist/* | ||
|
|
||
|
Comment on lines
+100
to
+121
Contributor
Author
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. Addressed in commit f256d6c with a prominent YAML comment block before the The actual Trusted Publisher reconfiguration is a manual step on pypi.org/test.pypi.org — it can't be done in code. |
||
| publish-pypi: | ||
| name: Publish → PyPI | ||
| needs: [build, publish-testpypi] | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/p/starfix | ||
| permissions: | ||
| id-token: write # required for OIDC trusted publishing | ||
| contents: write # required for creating the GitHub Release | ||
| steps: | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@e58605a9b6da7c637471fab8847a5e5a6b8df081 # v5 | ||
|
|
||
| - name: Download dist artifact | ||
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to PyPI | ||
| run: uv publish dist/* | ||
|
|
||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2 | ||
| with: | ||
| tag_name: "v${{ needs.build.outputs.version }}" | ||
| generate_release_notes: true | ||
| files: dist/* | ||
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.
Fixed in commit 0c3b7c9. Added an explicit
permissionsblock to thedependency-reviewjob withcontents: readandpull-requests: read. The workflow-level block stays atcontents: readonly; the extra permission is scoped to only the job that needs it.