From 631ef564aa8f33bba4aef34c53a751a33f48feb0 Mon Sep 17 00:00:00 2001 From: Catherine Date: Fri, 10 May 2024 13:32:11 +0000 Subject: [PATCH] CI: fix schema publishing. Previously, two concurrent jobs were used, which caused a race condition. Serialize them. --- .github/workflows/main.yaml | 48 ++++++++++++++++++------------------- amaranth/lib/meta.py | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d3a361b..5ff9a64 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -162,30 +162,6 @@ jobs: steps: - run: ${{ contains(needs.*.result, 'failure') && 'false' || 'true' }} - publish-schemas: - needs: document - if: ${{ github.repository == 'amaranth-lang/amaranth' }} - runs-on: ubuntu-latest - steps: - - name: Check out source code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Download schema archive - uses: actions/download-artifact@v4 - with: - name: schema - path: schema/ - - name: Publish development schemas - if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} - uses: JamesIves/github-pages-deploy-action@releases/v4 - with: - repository-name: amaranth-lang/amaranth-lang.github.io - ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }} - branch: main - folder: schema/ - target-folder: schema/amaranth/ - publish-docs: needs: document if: ${{ github.repository == 'amaranth-lang/amaranth' }} @@ -242,6 +218,30 @@ jobs: folder: pages/ clean: false + publish-schemas: + needs: [required, publish-docs] # avoid race condition with publish-docs + if: ${{ github.repository == 'amaranth-lang/amaranth' }} + runs-on: ubuntu-latest + steps: + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Download schema archive + uses: actions/download-artifact@v4 + with: + name: schema + path: schema/ + - name: Publish schemas + if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }} + uses: JamesIves/github-pages-deploy-action@releases/v4 + with: + repository-name: amaranth-lang/amaranth-lang.github.io + ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }} + branch: main + folder: schema/ + target-folder: schema/amaranth/ + publish-package: needs: required runs-on: ubuntu-latest diff --git a/amaranth/lib/meta.py b/amaranth/lib/meta.py index 84c6afa..b005557 100644 --- a/amaranth/lib/meta.py +++ b/amaranth/lib/meta.py @@ -135,7 +135,7 @@ def _extract_schemas(package, *, base_uri, path="schema/"): entry_points = distribution(package).entry_points for entry_point in entry_points.select(group="amaranth.lib.meta"): schema = entry_point.load().schema - relative_path = entry_point.name # v0.5/component.json + relative_path = entry_point.name # "0.5/component.json" schema_filename = pathlib.Path(path) / relative_path assert schema["$id"] == f"{base_uri}/{relative_path}", \ f"Schema $id {schema['$id']} must be {base_uri}/{relative_path}"