Repository navigation
Keep the public site current and add an interactive mathematical atlas #387
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ac79fac
Add current source discovery and interactive mathematical atlas
d6g8k5htny-coder cf9c82d
Retain published research snapshots and complete current atlas controls
d6g8k5htny-coder 8d1a853
Bind site publication to durable receipts and compact mathematical ar…
d6g8k5htny-coder 8074741
Document exact prepared-artifact recovery and pre-merge Pages ordering
d6g8k5htny-coder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,239 @@ | ||
| name: Current research site | ||
|
|
||
| 'on': | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'docs/site/**' | ||
| - 'tools/current_site_data.py' | ||
| - 'tools/current_site_build.py' | ||
| - 'tools/current_site_history.py' | ||
| - 'tools/current_site_publication.py' | ||
| - 'tests/test_current_site*' | ||
| - '.github/workflows/current-site.yml' | ||
| schedule: | ||
| - cron: '*/30 * * * *' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| # A refresh failure never reaches deployment. Do not interrupt a live publish. | ||
| concurrency: | ||
| group: current-research-pages-${{ github.event_name == 'pull_request' && github.event.pull_request.number || 'publish' }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| controls: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Offline source and reader admission controls | ||
| run: | | ||
| python3 -B -S -m unittest discover -s tests -p 'test_current_site*.py' -v | ||
| python3 -B -O -S -m unittest discover -s tests -p 'test_current_site*.py' -v | ||
| node --test tests/test_current_site.mjs | ||
|
|
||
| build: | ||
| needs: controls | ||
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'd6g8k5htny-coder/main' | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 20 | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| publication-metadata-id: ${{ steps.publication-metadata.outputs.artifact-id }} | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| persist-credentials: false | ||
| - name: Restore and admit all previously published public history | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: python3 -B -S tools/current_site_publication.py restore --site docs/site --allow-bootstrap | ||
| - name: Verify the checkout and acquire one immutable public source observation | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: | | ||
| test "$(git rev-parse HEAD)" = "$GITHUB_SHA" | ||
| python3 -B -S tools/current_site_data.py --main-commit "$GITHUB_SHA" --output "$RUNNER_TEMP/current.json" | ||
| - name: First offline render and asset identity | ||
| run: | | ||
| python3 -B -S tools/current_site_build.py --payload "$RUNNER_TEMP/current.json" --site docs/site | ||
| python3 -B -S tools/current_site_history.py publish --site docs/site | ||
| rm -f docs/site/.current-site-restored-history.json | ||
| git add -A -- docs/site docs/public-math | ||
| python3 -B -S tools/site_asset_release.py | ||
| python3 -B -S tools/current_site_history.py publish --site docs/site | ||
| python3 -B -S tools/site_asset_release.py --check | ||
| cp -a docs "$RUNNER_TEMP/current-site-first" | ||
| - name: Second offline render must equal the first complete docs artifact | ||
| run: | | ||
| python3 -B -S tools/current_site_build.py --payload "$RUNNER_TEMP/current.json" --site docs/site | ||
| python3 -B -S tools/current_site_history.py publish --site docs/site | ||
| git add -A -- docs/site docs/public-math | ||
| python3 -B -S tools/site_asset_release.py | ||
| python3 -B -S tools/current_site_history.py publish --site docs/site | ||
| python3 -B -S tools/site_asset_release.py --check | ||
| diff -qr "$RUNNER_TEMP/current-site-first" docs | ||
| - name: Verify the generated reader routes and existing evidence controls | ||
| run: | | ||
| python3 -B -S -m unittest discover -s tests -p test_reader_links.py -v | ||
| python3 -B -S -m unittest discover -s tests -p test_public_shop_data.py -v | ||
| node --test tests/test_current_site.mjs tests/test_public_shop_frontend.mjs tests/test_reader_navigation.mjs tests/test_dependency_viewer.mjs tests/test_source_reference.mjs tests/test_workspace_navigation.mjs | ||
| - name: Assemble the verified artifact with the complete legacy docs namespace | ||
| run: | | ||
| python3 -B -S - <<'PY' | ||
| from pathlib import Path | ||
| root = Path('docs') | ||
| if any(path.is_symlink() for path in root.rglob('*')): | ||
| raise SystemExit('Pages artifact refused: symlinked public content') | ||
| if sum(path.stat().st_size for path in root.rglob('*') if path.is_file()) > 1024 * 1024 * 1024: | ||
| raise SystemExit('Pages artifact refused: complete docs exceeds 1 GiB capacity') | ||
| if (root / 'site/.current-site-restored-history.json').exists(): | ||
| raise SystemExit('Pages artifact refused: operational restored-history ledger') | ||
| PY | ||
| cp -a docs "$RUNNER_TEMP/current-site-pages" | ||
| diff -qr "$RUNNER_TEMP/current-site-first" "$RUNNER_TEMP/current-site-pages" | ||
| - name: Record the assembled browser input before optional setup | ||
| run: | | ||
| python3 -B -S - <<'PY' | ||
| import hashlib, json, os, subprocess | ||
| from pathlib import Path | ||
| artifact = Path(os.environ['RUNNER_TEMP']) / 'current-site-pages' | ||
| output = Path(os.environ['RUNNER_TEMP']) / 'current-site-browser' | ||
| output.mkdir(parents=True, exist_ok=True) | ||
| pending = {'scientific_effect': 'NONE', 'cases': [], | ||
| 'error': 'Generated-artifact Chromium check has not completed; inspect setup and run logs.'} | ||
| (output / 'report.json').write_text(json.dumps(pending, indent=2) + '\n') | ||
| raw = (artifact / 'site/current.json').read_bytes() | ||
| if raw != Path('docs/site/current.json').read_bytes(): | ||
| raise SystemExit('Browser input differs from the assembled Pages payload') | ||
| files = sorted((p for p in artifact.rglob('*') if p.is_file()), | ||
| key=lambda p: p.relative_to(artifact).as_posix()) | ||
| tree = hashlib.sha256(b'current-site-generated-browser-input-v1\0') | ||
| total = 0 | ||
| for path in files: | ||
| name = path.relative_to(artifact).as_posix().encode('utf-8') | ||
| size = path.stat().st_size | ||
| tree.update(len(name).to_bytes(8, 'big')); tree.update(name) | ||
| tree.update(size.to_bytes(8, 'big')); total += size | ||
| with path.open('rb') as source: | ||
| while chunk := source.read(1024 * 1024): | ||
| tree.update(chunk) | ||
| record = {'scientific_effect': 'NONE', | ||
| 'checked_commit': subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip(), | ||
| 'source_payload_sha256': hashlib.sha256(raw).hexdigest(), | ||
| 'source_repositories': json.loads(raw)['repositories'], | ||
| 'assembled_docs_sha256': tree.hexdigest(), | ||
| 'assembled_docs_files': len(files), 'assembled_docs_bytes': total} | ||
| (output / 'artifact-input.json').write_text(json.dumps(record, indent=2) + '\n') | ||
| (output / 'report.json').write_text(json.dumps({**record, **pending}, indent=2) + '\n') | ||
| PY | ||
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 | ||
| with: | ||
| python-version: '3.12' | ||
| - name: Install pinned optional browser tooling | ||
| run: >- | ||
| python -m pip install --require-hashes --only-binary=:all: -r tests/browser-requirements.txt | ||
| - name: Admit the generated Pages artifact in packaged Chromium | ||
| run: | | ||
| diff -qr docs "$RUNNER_TEMP/current-site-pages" | ||
| python -B tools/current_site_browser_check.py --output "$RUNNER_TEMP/current-site-browser" | ||
| diff -qr docs "$RUNNER_TEMP/current-site-pages" | ||
| - name: Preserve generated-artifact browser evidence including failures | ||
| if: always() | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 | ||
| with: | ||
| name: current-site-generated-browser-${{ github.run_id }}-${{ github.run_attempt }} | ||
| path: ${{ runner.temp }}/current-site-browser | ||
| if-no-files-found: error | ||
| retention-days: 30 | ||
| - name: Bind exact qualified metadata to the browser-tested Pages artifact | ||
| run: | | ||
| diff -qr docs "$RUNNER_TEMP/current-site-pages" | ||
| python3 -B -S tools/current_site_publication.py package --site "$RUNNER_TEMP/current-site-pages/site" --artifact-input "$RUNNER_TEMP/current-site-browser/artifact-input.json" --browser-report "$RUNNER_TEMP/current-site-browser/report.json" --output "$RUNNER_TEMP/current-site-publication-metadata" | ||
| - name: Hand off the exact qualified publication metadata | ||
| id: publication-metadata | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 | ||
| with: | ||
| name: current-site-publication-metadata-${{ github.run_id }}-${{ github.run_attempt }} | ||
| path: ${{ runner.temp }}/current-site-publication-metadata | ||
| if-no-files-found: error | ||
| retention-days: 30 | ||
| # Official action refs resolved and interfaces read on 2026-10-13. | ||
| - name: Upload the verified Pages artifact | ||
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | ||
| with: | ||
| path: ${{ runner.temp }}/current-site-pages | ||
| include-hidden-files: true | ||
|
|
||
| deploy: | ||
| needs: build | ||
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'd6g8k5htny-coder/main' | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 30 | ||
| permissions: | ||
| # The stdlib emitter permits only latest.json on the fixed receipt branch. | ||
| # GitHub's token is repository-scoped; source/main/force writes are refused. | ||
| contents: write | ||
| pages: write | ||
| id-token: write | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| steps: | ||
| - name: Check out only the tested source commit for the stdlib receipt tool | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | ||
| with: | ||
| ref: ${{ github.sha }} | ||
| persist-credentials: false | ||
| - name: Receive the exact qualified publication metadata | ||
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5 | ||
| with: | ||
| artifact-ids: ${{ needs.build.outputs.publication-metadata-id }} | ||
| path: ${{ runner.temp }}/current-site-publication-metadata | ||
| # A distinct integrator verifies Actions source before enabling publication. | ||
| - name: Read the existing Pages configuration | ||
| uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | ||
| with: | ||
| enablement: false | ||
| - name: Persist the prepared publication anchor before any Pages side effect | ||
| id: preparation | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: | | ||
| python3 -B -S tools/current_site_publication.py prepare --metadata "$RUNNER_TEMP/current-site-publication-metadata" --prepared "$RUNNER_TEMP/current-site-prepared.json" --allow-bootstrap | ||
| python3 -B -S - <<'PY' | ||
| import json, os | ||
| from pathlib import Path | ||
| phase = json.loads((Path(os.environ['RUNNER_TEMP']) / 'current-site-prepared.json').read_bytes())['receipt']['phase'] | ||
| if phase not in ('prepared', 'observed'): | ||
| raise SystemExit('Unadmitted publication phase') | ||
| with open(os.environ['GITHUB_OUTPUT'], 'a') as output: | ||
| output.write('phase=' + phase + '\n') | ||
| PY | ||
| - name: Deploy the verified artifact | ||
| if: steps.preparation.outputs.phase == 'prepared' | ||
| id: deployment | ||
| uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 | ||
| - name: Observe exact public bytes before appending the observed receipt | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: python3 -B -S tools/current_site_publication.py observe --metadata "$RUNNER_TEMP/current-site-publication-metadata" --prepared "$RUNNER_TEMP/current-site-prepared.json" | ||
| - name: Preserve prepared state for diagnosis even after a publish or readback failure | ||
| if: always() | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 | ||
| with: | ||
| name: current-site-publication-state-${{ github.run_id }}-${{ github.run_attempt }} | ||
| path: ${{ runner.temp }}/current-site-prepared.json | ||
| if-no-files-found: warn | ||
| retention-days: 30 | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.