diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c835a6829..c8a46a1a9 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' && matrix.client_postgres != true }}
runs-on: ${{ matrix.runner }}
services: &build-services
postgres:
@@ -158,6 +187,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
@@ -552,29 +596,3 @@ jobs:
should_run: true
client_postgres: 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 1c9a1a30a..d5c595786 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: 2 entries, 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: 6 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, after xftp-web is built with Node.js 22 (`npm install`, `npm run build`) for the XFTP Web Client tests. In both builds, the ubuntu-24.04 x86-64 entry named "PostgreSQL agent store" builds and runs only the tests built with `-fclient_postgres -fslow_servers` (agent with the PostgreSQL store, and XFTP servers that delay responses for the slow-server test, which the other builds skip), in the build directory dist-client-postgres, in step "Test with PostgreSQL agent store", in parallel with the other entries; its build directory has its own cache key. After the tests, step "Check generated files" fails if a test changed a tracked file: the schema dump and query plan tests overwrite their files, so a stale file fails here even when the test passes on retry. 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, after xftp-web is built with Node.js 22 (`npm install`, `npm run build`) for the XFTP Web Client tests. In both builds, the ubuntu-24.04 x86-64 entry named "PostgreSQL agent store" builds and runs only the tests built with `-fclient_postgres -fslow_servers` (agent with the PostgreSQL store, and XFTP servers that delay responses for the slow-server test, which the other builds skip), in the build directory dist-client-postgres, in step "Test with PostgreSQL agent store", in parallel with the other entries; its build directory has its own cache key. After the tests, step "Check generated files" fails if a test changed a tracked file: the schema dump and query plan tests overwrite their files, so a stale file fails here even when the test passes on retry. 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.
+
+The ubuntu-24.04 x86-64 entry without the PostgreSQL agent store 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".
## Test selection