From 28bb17976fdeb0d527fb19f21a3cb49c65e1ef0f Mon Sep 17 00:00:00 2001 From: brenzi-agent Date: Wed, 4 Nov 2026 07:19:23 +0000 Subject: [PATCH 1/2] ci: lint and test the resolver in the Linux build job when it changes --- .github/workflows/build.yml | 70 +++++++++++++++++++++++-------------- scripts/ci/README.md | 8 ++++- 2 files changed, 51 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b957b5aab..05f46b6b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,7 @@ jobs: runs-on: ubuntu-latest outputs: reduced: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == true || (github.event_name == 'push' && github.ref_type == 'branch' && github.repository != 'simplex-chat/simplexmq') }} + resolver: ${{ steps.changes.outputs.resolver }} steps: - name: Reject a manual run on a tag if: github.event_name == 'workflow_dispatch' && github.ref_type == 'tag' @@ -40,6 +41,33 @@ jobs: echo "::error::A manual run starts on a branch; to retry a release, re-run the jobs of its tag push." exit 1 + - name: Clone project to check changes + if: github.event_name != 'push' + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Check changes + id: changes + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + case "$GITHUB_EVENT_NAME" in + pull_request) + base=HEAD^1 + ;; + workflow_dispatch) + base=$(gh api "repos/$GITHUB_REPOSITORY/compare/master...$GITHUB_REF_NAME" --jq .merge_base_commit.sha) + git fetch -q --depth=1 origin "$base" + ;; + *) + echo "resolver=true" >> "$GITHUB_OUTPUT" + exit 0 + ;; + esac + git diff --quiet "$base" HEAD -- scripts/resolver/service .github/workflows/build.yml || echo "resolver=true" >> "$GITHUB_OUTPUT" + - name: Clone project if: startsWith(github.ref, 'refs/tags/v') uses: actions/checkout@v3 @@ -95,6 +123,7 @@ jobs: cache_o0: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/stable') }} image_cache: ghcr.io/${{ github.repository_owner }}/simplexmq-build-cache:${{ matrix.os }}-${{ matrix.arch }}-ghc${{ matrix.ghc }} source_hashes: dist-newstyle/sources.sha256 + resolver: ${{ needs.maybe-release.outputs.resolver == 'true' && matrix.os == '24.04' && matrix.arch == 'x86-64' }} runs-on: ${{ matrix.runner }} services: &build-services postgres: @@ -150,6 +179,21 @@ jobs: with: submodules: recursive + - name: Set up uv + if: env.resolver == 'true' + # uv takes Python from .python-version, the version of the Dockerfile's runtime stage. + uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 + + - name: Lint resolver + if: env.resolver == 'true' + working-directory: scripts/resolver/service + run: uv run --frozen ruff check . + + - name: Test resolver + if: env.resolver == 'true' + working-directory: scripts/resolver/service + run: uv run --frozen pytest -v + - name: Set up Docker Buildx if: matrix.should_run == true uses: simplex-chat/docker-setup-buildx-action@v3 @@ -483,29 +527,3 @@ jobs: ghc: "9.6.3" should_run: true steps: *build-steps - -# ============================= -# Resolver test job -# ============================= - -# The SNRC resolver is Python, so this job needs none of the Haskell toolchain -# above and runs independently of it. - - resolver-test: - name: "resolver (python)" - runs-on: ubuntu-latest - steps: - - name: Clone project - uses: actions/checkout@v3 - - - name: Set up uv - # uv takes Python from .python-version, the version of the Dockerfile's runtime stage. - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 - - - name: Lint - working-directory: scripts/resolver/service - run: uv run --frozen ruff check . - - - name: Test - working-directory: scripts/resolver/service - run: uv run --frozen pytest -v diff --git a/scripts/ci/README.md b/scripts/ci/README.md index 60287eae9..1d73b2eb9 100644 --- a/scripts/ci/README.md +++ b/scripts/ci/README.md @@ -9,7 +9,13 @@ | a push to a draft pull request
a manual run (workflow_dispatch)
a push to master or stable in a fork | reduced | build-reduced: ubuntu-24.04 x86-64, GHC 9.6.3, at -O0 (-O2 on pushes), without the standard build | | a pull request marked ready for review, and later pushes to it
a push to master or stable in simplex-chat/simplexmq
a push of a v* tag | full | build: 5 entries (GHC 8.10.7 and 9.6.3, x86-64 and aarch64), at -O0 on pull requests and -O2 on pushes | -Both builds also run maybe-release and resolver (python). Tests run on the x86-64 entries. The reduced build restores the -O0 build caches saved by master pushes; the Docker image cache is tagged by ISO week, so the first run of a week rebuilds the image. +Both builds also run maybe-release. Tests run on the x86-64 entries. + +The ubuntu-24.04 x86-64 entry also lints and tests the resolver (scripts/resolver/service, steps "Lint resolver" and "Test resolver"): +- on a push; +- on a pull request or a manual run that changes scripts/resolver/service or build.yml. A manual run is compared with its merge base with master. + +Local run: scripts/resolver/README.md, "Resolver API reference". The reduced build restores the -O0 build caches saved by master pushes; the Docker image cache is tagged by ISO week, so the first run of a week rebuilds the image. ## Test selection From 7fa54c027a3606cf3a0287a526e035d54dc87ae9 Mon Sep 17 00:00:00 2001 From: brenzi-agent <346870783+brenzi-agent@users.noreply.github.com> Date: Tue, 24 Nov 2026 16:41:01 +0000 Subject: [PATCH 2/2] ci: lint and test the resolver once, not in the PostgreSQL agent store entry --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c10fc9dc8..c8a46a1a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,7 +123,7 @@ jobs: cache_o0: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/stable') }} image_cache: ghcr.io/${{ github.repository_owner }}/simplexmq-build-cache:${{ matrix.os }}-${{ matrix.arch }}-ghc${{ matrix.ghc }} source_hashes: dist-newstyle/sources.sha256 - resolver: ${{ needs.maybe-release.outputs.resolver == 'true' && matrix.os == '24.04' && matrix.arch == 'x86-64' }} + resolver: ${{ needs.maybe-release.outputs.resolver == 'true' && matrix.os == '24.04' && matrix.arch == 'x86-64' && matrix.client_postgres != true }} runs-on: ${{ matrix.runner }} services: &build-services postgres: