From c9b3de83fe015f2e340a1bea7a4ee83a7f001c7b Mon Sep 17 00:00:00 2001
From: "Evgeny @ SimpleX Chat"
<259188159+evgeny-simplex@users.noreply.github.com>
Date: Mon, 26 Oct 2026 18:02:44 +0000
Subject: [PATCH] ci: reduced build on pushes to master and stable in forks
(#1991)
* ci: reduced build on pushes to master and stable in forks
* ci: master pushes finish their cache saves
* ci: test retry message only when retrying
---
.github/workflows/build.yml | 7 ++++---
scripts/ci/README.md | 4 ++--
scripts/ci/run-tests.sh | 6 +++---
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3a00396bc..b957b5aab 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -18,7 +18,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') }}
+ cancel-in-progress: ${{ github.event_name != 'push' }}
jobs:
@@ -32,7 +32,7 @@ jobs:
maybe-release:
runs-on: ubuntu-latest
outputs:
- reduced: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.draft == true }}
+ 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') }}
steps:
- name: Reject a manual run on a tag
if: github.event_name == 'workflow_dispatch' && github.ref_type == 'tag'
@@ -260,6 +260,7 @@ jobs:
run: scripts/ci/source-timestamps.sh restore ${{ env.source_hashes }}
- name: Build smp-server, xftp-server (postgresql) and tests
+ id: build-postgres
if: matrix.should_run == true
shell: docker exec -t builder sh -eu {0}
run: |
@@ -418,7 +419,7 @@ jobs:
- name: Remove -O2 build directories
id: remove-o2
- if: env.cache_o0 == 'true' && !cancelled() && steps.build-standard.outcome == 'success'
+ 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
diff --git a/scripts/ci/README.md b/scripts/ci/README.md
index c4064dcdb..60287eae9 100644
--- a/scripts/ci/README.md
+++ b/scripts/ci/README.md
@@ -6,8 +6,8 @@
| Trigger | Build | Jobs |
|---|---|---|
-| a push to a draft pull request
a manual run (workflow_dispatch) | reduced | build-reduced: ubuntu-24.04 x86-64, GHC 9.6.3, at -O0, without the standard build |
-| a pull request marked ready for review, and later pushes to it
a push to master or stable
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
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.
diff --git a/scripts/ci/run-tests.sh b/scripts/ci/run-tests.sh
index 327ff667c..ef7c92112 100755
--- a/scripts/ci/run-tests.sh
+++ b/scripts/ci/run-tests.sh
@@ -26,13 +26,13 @@ attempts=${ATTEMPTS:-1}
while [ "$i" -le "$attempts" ]; do
if "$@" "${args[@]}"; then
break
- else
+ elif [ "$i" -lt "$attempts" ]; then
echo "Attempt $i failed, retrying..."
- i=$((i + 1))
sleep 1
fi
+ i=$((i + 1))
done
if [ "$i" -gt "$attempts" ]; then
- echo "All $attempts attempts failed."
+ echo "Attempt $attempts failed."
exit 1
fi