mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-11-22 19:58:39 +00:00
ci, tests: run all tests in CI, also with the PostgreSQL agent store (#2065)
* ci, tests: run all tests in CI * ci: test with PostgreSQL agent store on one entry * ci: link libsodium-sumo module for xftp-web tests * tests: run stress tests at 1k messages * tests: wait for subscription events from all servers of remaining connections * ci, tests: fail on stale generated files, update agent PostgreSQL schema dump * ci: give the PostgreSQL test server 1 GB of shared memory * ci, tests: run slow XFTP server test in a flagged test build only
This commit is contained in:
1 parent
7d0cd4294d
commit
a21ff5dbf6
11 files changed
+114
-77
No files matched your search
@@ -106,6 +106,7 @@ jobs:
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
--shm-size 1g
|
||||
ports:
|
||||
# Maps tcp port 5432 on service container to the host
|
||||
- 5432:5432
|
||||
@@ -131,6 +132,7 @@ jobs:
|
||||
runner: "ubuntu-24.04"
|
||||
ghc: "9.6.3"
|
||||
should_run: true
|
||||
client_postgres: true
|
||||
- os: 22.04
|
||||
os_underscore: 22_04
|
||||
arch: aarch64
|
||||
@@ -246,6 +248,7 @@ jobs:
|
||||
path: |
|
||||
dist-newstyle
|
||||
dist-postgres
|
||||
dist-client-postgres
|
||||
key: ${{ steps.keys.outputs.dist }}-${{ env.opt }}-${{ env.branch }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ steps.keys.outputs.dist }}-${{ env.opt }}-${{ env.branch }}-
|
||||
@@ -264,8 +267,8 @@ jobs:
|
||||
if: matrix.should_run == true
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: |
|
||||
chmod -fR 777 ~/.cabal ./dist-newstyle ./dist-postgres || :; git config --global --add safe.directory '*'
|
||||
scripts/ci/prune-old-builds.sh dist-newstyle dist-postgres
|
||||
chmod -fR 777 ~/.cabal ./dist-newstyle ./dist-postgres ./dist-client-postgres || :; git config --global --add safe.directory '*'
|
||||
scripts/ci/prune-old-builds.sh dist-newstyle dist-postgres dist-client-postgres
|
||||
cabal update
|
||||
cabal build --builddir=${{ env.postgres_dist }} --jobs=$(nproc) --enable-tests -fserver_postgres ${{ env.ghc_options }}
|
||||
mkdir -p /out
|
||||
@@ -282,6 +285,21 @@ jobs:
|
||||
run: |
|
||||
docker cp builder:/out/simplexmq-test .
|
||||
|
||||
- name: Build tests with PostgreSQL agent store
|
||||
id: build-client-postgres
|
||||
if: matrix.should_run == true && matrix.client_postgres == true
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: |
|
||||
cabal build --builddir=dist-client-postgres --jobs=$(nproc) --enable-tests -fserver_postgres -fclient_postgres -fslow_servers ${{ env.ghc_options }} simplexmq-test
|
||||
bin=$(find /project/dist-client-postgres -name simplexmq-test -type f -executable)
|
||||
cp "$bin" /out/simplexmq-test-client-postgres
|
||||
|
||||
- name: Copy simplexmq-test-client-postgres from container
|
||||
if: matrix.should_run == true && matrix.client_postgres == true
|
||||
shell: bash
|
||||
run: |
|
||||
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
|
||||
id: prepare-postgres
|
||||
@@ -387,6 +405,7 @@ jobs:
|
||||
path: |
|
||||
dist-newstyle
|
||||
dist-postgres
|
||||
dist-client-postgres
|
||||
key: ${{ steps.keys.outputs.dist }}-${{ env.opt }}-${{ env.branch }}-${{ github.sha }}
|
||||
|
||||
- name: Increase PostgreSQL connection limit
|
||||
@@ -405,11 +424,25 @@ jobs:
|
||||
sudo mount -t tmpfs -o size=2G tmpfs tests/tmp
|
||||
sudo chown $(id -u):$(id -g) tests/tmp
|
||||
|
||||
- name: Setup Node.js
|
||||
if: matrix.should_run == true && matrix.arch == 'x86-64'
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Build xftp-web for tests
|
||||
if: matrix.should_run == true && matrix.arch == 'x86-64'
|
||||
working-directory: xftp-web
|
||||
run: |
|
||||
npm install
|
||||
ln -sf ../../../libsodium-sumo/dist/modules-sumo-esm/libsodium-sumo.mjs node_modules/libsodium-wrappers-sumo/dist/modules-sumo-esm/libsodium-sumo.mjs
|
||||
npm run build
|
||||
|
||||
- name: Test
|
||||
if: matrix.should_run == true && matrix.arch == 'x86-64'
|
||||
timeout-minutes: 120
|
||||
shell: bash
|
||||
env:
|
||||
env: &test-env
|
||||
PGHOST: localhost
|
||||
REDUCED: ${{ needs.maybe-release.outputs.reduced }}
|
||||
TESTS: ${{ github.event_name == 'workflow_dispatch' && inputs.tests || '' }}
|
||||
@@ -417,11 +450,23 @@ jobs:
|
||||
ATTEMPTS: ${{ (github.ref == 'refs/heads/stable' || startsWith(github.ref, 'refs/tags/v')) && 3 || 1 }}
|
||||
run: scripts/ci/run-tests.sh ./simplexmq-test
|
||||
|
||||
- name: Test with PostgreSQL agent store
|
||||
if: ${{ !cancelled() && steps.build-client-postgres.outcome == 'success' }}
|
||||
timeout-minutes: 120
|
||||
shell: bash
|
||||
env: *test-env
|
||||
run: scripts/ci/run-tests.sh ./simplexmq-test-client-postgres
|
||||
|
||||
- name: Check generated files
|
||||
if: ${{ !cancelled() && matrix.should_run == true && matrix.arch == 'x86-64' }}
|
||||
shell: bash
|
||||
run: git diff --exit-code
|
||||
|
||||
- name: Remove -O2 build directories
|
||||
id: remove-o2
|
||||
if: env.cache_o0 == 'true' && !cancelled() && steps.build-postgres.outcome == 'success' && steps.build-standard.outcome != 'failure'
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: rm -rf dist-newstyle dist-postgres
|
||||
run: rm -rf dist-newstyle dist-postgres dist-client-postgres
|
||||
|
||||
- name: Restore -O0 build directories from cache
|
||||
id: restore-build-o0
|
||||
@@ -431,6 +476,7 @@ jobs:
|
||||
path: |
|
||||
dist-newstyle
|
||||
dist-postgres
|
||||
dist-client-postgres
|
||||
key: ${{ steps.keys.outputs.dist }}-O0-${{ env.branch }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ steps.keys.outputs.dist }}-O0-${{ env.branch }}-
|
||||
@@ -445,9 +491,12 @@ jobs:
|
||||
if: ${{ !cancelled() && steps.remove-o2.outcome == 'success' }}
|
||||
shell: docker exec -t builder sh -eu {0}
|
||||
run: |
|
||||
scripts/ci/prune-old-builds.sh dist-newstyle dist-postgres
|
||||
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
|
||||
fi
|
||||
|
||||
- name: Record source hashes for -O0 build (GHC 8.10.7)
|
||||
if: ${{ !cancelled() && matrix.ghc == '8.10.7' && steps.build-o0.outcome == 'success' }}
|
||||
@@ -461,6 +510,7 @@ jobs:
|
||||
path: |
|
||||
dist-newstyle
|
||||
dist-postgres
|
||||
dist-client-postgres
|
||||
key: ${{ steps.keys.outputs.dist }}-O0-${{ env.branch }}-${{ github.sha }}
|
||||
|
||||
build-reduced:
|
||||
@@ -482,6 +532,7 @@ jobs:
|
||||
runner: "ubuntu-24.04"
|
||||
ghc: "9.6.3"
|
||||
should_run: true
|
||||
client_postgres: true
|
||||
steps: *build-steps
|
||||
|
||||
# =============================
|
||||
|
||||
Reference in new issue
Block a user