mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-11-22 17:48:24 +00:00
ci: run the PostgreSQL agent store tests in their own job (#2086)
This commit is contained in:
1 parent
9ffd36ed8c
commit
e32e7ae92e
2 files changed
+34
-16
No files matched your search
+31
-13
@@ -79,7 +79,7 @@ jobs:
|
||||
# =============================
|
||||
|
||||
build:
|
||||
name: "ubuntu-${{ matrix.os }}-${{ matrix.arch }}, GHC: ${{ matrix.ghc }}"
|
||||
name: "ubuntu-${{ matrix.os }}-${{ matrix.arch }}, GHC: ${{ matrix.ghc }}${{ matrix.client_postgres && ', PostgreSQL agent store' || '' }}"
|
||||
needs: maybe-release
|
||||
if: needs.maybe-release.outputs.reduced != 'true'
|
||||
permissions:
|
||||
@@ -126,6 +126,12 @@ jobs:
|
||||
runner: "ubuntu-22.04"
|
||||
ghc: "9.6.3"
|
||||
should_run: true
|
||||
- os: 24.04
|
||||
os_underscore: 24_04
|
||||
arch: x86-64
|
||||
runner: "ubuntu-24.04"
|
||||
ghc: "9.6.3"
|
||||
should_run: true
|
||||
- os: 24.04
|
||||
os_underscore: 24_04
|
||||
arch: x86-64
|
||||
@@ -223,7 +229,7 @@ jobs:
|
||||
toolchain=$(docker exec builder dpkg-query -W -f '${db:Status-Status} ${binary:Package} ${Version}\n' 'binutils*' 'cpp*' 'gcc*' '*-dev' | grep '^installed ' | sha256sum | cut -c1-16)
|
||||
target=${{ matrix.os }}-${{ matrix.arch }}-ghc${{ matrix.ghc }}-$toolchain
|
||||
echo "deps=deps-$target" >> "$GITHUB_OUTPUT"
|
||||
echo "dist=dist-$target" >> "$GITHUB_OUTPUT"
|
||||
echo "dist=dist-$target${{ matrix.client_postgres && '-client-postgres' || '' }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Restore dependencies from cache
|
||||
id: restore-deps
|
||||
@@ -264,7 +270,7 @@ jobs:
|
||||
|
||||
- name: Build smp-server, xftp-server (postgresql) and tests
|
||||
id: build-postgres
|
||||
if: matrix.should_run == true
|
||||
if: matrix.should_run == true && matrix.client_postgres != true
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: |
|
||||
chmod -fR 777 ~/.cabal ./dist-newstyle ./dist-postgres ./dist-client-postgres || :; git config --global --add safe.directory '*'
|
||||
@@ -280,7 +286,7 @@ jobs:
|
||||
strip /out/smp-server /out/xftp-server /out/ntf-server
|
||||
|
||||
- name: Copy simplexmq-test from container
|
||||
if: matrix.should_run == true
|
||||
if: matrix.should_run == true && matrix.client_postgres != true
|
||||
shell: bash
|
||||
run: |
|
||||
docker cp builder:/out/simplexmq-test .
|
||||
@@ -290,7 +296,11 @@ jobs:
|
||||
if: matrix.should_run == true && matrix.client_postgres == true
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: |
|
||||
chmod -fR 777 ~/.cabal ./dist-client-postgres || :; git config --global --add safe.directory '*'
|
||||
scripts/ci/prune-old-builds.sh dist-client-postgres
|
||||
cabal update
|
||||
cabal build --builddir=dist-client-postgres --jobs=$(nproc) --enable-tests -fserver_postgres -fclient_postgres -fslow_servers ${{ env.ghc_options }} simplexmq-test
|
||||
mkdir -p /out
|
||||
bin=$(find /project/dist-client-postgres -name simplexmq-test -type f -executable)
|
||||
cp "$bin" /out/simplexmq-test-client-postgres
|
||||
|
||||
@@ -301,7 +311,7 @@ jobs:
|
||||
docker cp builder:/out/simplexmq-test-client-postgres .
|
||||
|
||||
- name: Copy smp-server, xftp-server (postgresql) from container and prepare it
|
||||
if: startsWith(github.ref, 'refs/tags/v') && matrix.should_run == true
|
||||
if: startsWith(github.ref, 'refs/tags/v') && matrix.should_run == true && matrix.client_postgres != true
|
||||
id: prepare-postgres
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -326,7 +336,7 @@ jobs:
|
||||
|
||||
- name: Build everything else (standard)
|
||||
id: build-standard
|
||||
if: matrix.should_run == true && needs.maybe-release.outputs.reduced != 'true'
|
||||
if: matrix.should_run == true && matrix.client_postgres != true && needs.maybe-release.outputs.reduced != 'true'
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: |
|
||||
cabal build --jobs=$(nproc) ${{ env.ghc_options }}
|
||||
@@ -340,7 +350,7 @@ jobs:
|
||||
|
||||
- name: Copy binaries from container and prepare them
|
||||
id: prepare-regular
|
||||
if: startsWith(github.ref, 'refs/tags/v') && matrix.should_run == true
|
||||
if: startsWith(github.ref, 'refs/tags/v') && matrix.should_run == true && matrix.client_postgres != true
|
||||
shell: bash
|
||||
run: |
|
||||
docker cp builder:/out .
|
||||
@@ -365,7 +375,7 @@ jobs:
|
||||
cat hashes.output >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload binaries
|
||||
if: startsWith(github.ref, 'refs/tags/v') && matrix.should_run == true
|
||||
if: startsWith(github.ref, 'refs/tags/v') && matrix.should_run == true && matrix.client_postgres != true
|
||||
uses: simplex-chat/action-gh-release@v2
|
||||
with:
|
||||
append_body: true
|
||||
@@ -439,7 +449,7 @@ jobs:
|
||||
npm run build
|
||||
|
||||
- name: Test
|
||||
if: matrix.should_run == true && matrix.arch == 'x86-64'
|
||||
if: matrix.should_run == true && matrix.arch == 'x86-64' && matrix.client_postgres != true
|
||||
timeout-minutes: 120
|
||||
shell: bash
|
||||
env: &test-env
|
||||
@@ -464,7 +474,7 @@ jobs:
|
||||
|
||||
- name: Remove -O2 build directories
|
||||
id: remove-o2
|
||||
if: env.cache_o0 == 'true' && !cancelled() && steps.build-postgres.outcome == 'success' && steps.build-standard.outcome != 'failure'
|
||||
if: env.cache_o0 == 'true' && !cancelled() && (steps.build-postgres.outcome == 'success' || steps.build-client-postgres.outcome == 'success') && steps.build-standard.outcome != 'failure'
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: rm -rf dist-newstyle dist-postgres dist-client-postgres
|
||||
|
||||
@@ -492,10 +502,11 @@ jobs:
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: |
|
||||
scripts/ci/prune-old-builds.sh dist-newstyle dist-postgres dist-client-postgres
|
||||
cabal build --builddir=dist-postgres --jobs=$(nproc) --enable-tests -fserver_postgres --ghc-options=-O0
|
||||
cabal build --jobs=$(nproc) --ghc-options=-O0
|
||||
if [ "${{ matrix.client_postgres }}" = true ]; then
|
||||
cabal build --builddir=dist-client-postgres --jobs=$(nproc) --enable-tests -fserver_postgres -fclient_postgres -fslow_servers --ghc-options=-O0 simplexmq-test
|
||||
else
|
||||
cabal build --builddir=dist-postgres --jobs=$(nproc) --enable-tests -fserver_postgres --ghc-options=-O0
|
||||
cabal build --jobs=$(nproc) --ghc-options=-O0
|
||||
fi
|
||||
|
||||
- name: Record source hashes for -O0 build (GHC 8.10.7)
|
||||
@@ -514,7 +525,7 @@ jobs:
|
||||
key: ${{ steps.keys.outputs.dist }}-O0-${{ env.branch }}-${{ github.sha }}
|
||||
|
||||
build-reduced:
|
||||
name: "ubuntu-${{ matrix.os }}-${{ matrix.arch }}, GHC: ${{ matrix.ghc }}"
|
||||
name: "ubuntu-${{ matrix.os }}-${{ matrix.arch }}, GHC: ${{ matrix.ghc }}${{ matrix.client_postgres && ', PostgreSQL agent store' || '' }}"
|
||||
needs: maybe-release
|
||||
if: needs.maybe-release.outputs.reduced == 'true'
|
||||
permissions:
|
||||
@@ -524,8 +535,15 @@ jobs:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
services: *build-services
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: 24.04
|
||||
os_underscore: 24_04
|
||||
arch: x86-64
|
||||
runner: "ubuntu-24.04"
|
||||
ghc: "9.6.3"
|
||||
should_run: true
|
||||
- os: 24.04
|
||||
os_underscore: 24_04
|
||||
arch: x86-64
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
| Trigger | Build | Jobs |
|
||||
|---|---|---|
|
||||
| a push to a draft pull request<br>a manual run (workflow_dispatch)<br>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<br>a push to master or stable in simplex-chat/simplexmq<br>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 |
|
||||
| a push to a draft pull request<br>a manual run (workflow_dispatch)<br>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<br>a push to master or stable in simplex-chat/simplexmq<br>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. The ubuntu-24.04 x86-64 entry also runs 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". 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 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.
|
||||
|
||||
## Test selection
|
||||
|
||||
|
||||
Reference in new issue
Block a user