mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 21:52:28 +00:00
ci: reduce the number of runners (#7750)
Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
1 parent
1d0247b7dd
commit
5a5a927821
4 files changed
+94
-75
No files matched your search
+85
-43
@@ -176,9 +176,9 @@ jobs:
|
||||
env:
|
||||
image_cache: ghcr.io/simplex-chat/simplex-chat-build-cache:${{ matrix.os }}-${{ matrix.arch }}-ghc${{ matrix.ghc }}
|
||||
source_hashes: dist-newstyle/sources.sha256
|
||||
concurrency:
|
||||
concurrency: &linux-concurrency
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-linux-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ghc }}-${{ needs.maybe-release.outputs.libs_tag }}
|
||||
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') && !needs.maybe-release.outputs.libs_tag }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -205,22 +205,7 @@ jobs:
|
||||
should_run: true
|
||||
ghc: ${{ needs.variables.outputs.GHC_VER }}
|
||||
hash: 'sha256:98ff7968124952e719a8a69bb3cccdd217f5fe758108ac4f21ad22e1df44d237'
|
||||
- os: 22.04
|
||||
os_underscore: 22_04
|
||||
arch: aarch64
|
||||
runner: "ubuntu-22.04-arm"
|
||||
should_run: true
|
||||
ghc: ${{ needs.variables.outputs.GHC_VER }}
|
||||
hash: 'sha256:6a62a4157b8775eaf4959cb629e757d32d39d1f4c8ac1b0ddc2510b555cf72f3'
|
||||
libs: true
|
||||
- os: 24.04
|
||||
os_underscore: 24_04
|
||||
arch: aarch64
|
||||
runner: "ubuntu-24.04-arm"
|
||||
should_run: true
|
||||
ghc: ${{ needs.variables.outputs.GHC_VER }}
|
||||
hash: 'sha256:68434214381cb38287104e629fe8ee720167dd98cbb36ab1cbbab342515fa6ab'
|
||||
steps:
|
||||
steps: &linux-steps
|
||||
- name: Checkout Code
|
||||
if: matrix.should_run == true
|
||||
uses: actions/checkout@v3
|
||||
@@ -398,7 +383,7 @@ jobs:
|
||||
done
|
||||
strip /out/simplex-chat
|
||||
|
||||
# Also for pull requests that change the chat core, for the package tests (packages-pr).
|
||||
# Also for pull requests that change the chat core, for the package tests.
|
||||
- name: Build library
|
||||
id: build-lib
|
||||
if: matrix.libs && (needs.maybe-release.outputs.libs_tag || (needs.maybe-release.outputs.core_changed && matrix.arch == 'x86_64'))
|
||||
@@ -457,14 +442,6 @@ jobs:
|
||||
!dist-lib/src
|
||||
key: ${{ steps.keys.outputs.dist_lib }}-${{ env.branch }}-${{ github.sha }}
|
||||
|
||||
- name: Upload library artifact
|
||||
if: matrix.libs && needs.maybe-release.outputs.core_changed && matrix.arch == 'x86_64'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: simplex-chat-libs-linux-${{ matrix.arch }}
|
||||
path: release-libs/simplex-chat-libs-linux-${{ matrix.arch }}.zip
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload library
|
||||
if: needs.maybe-release.outputs.libs_tag && matrix.libs
|
||||
uses: softprops/action-gh-release@v2
|
||||
@@ -612,6 +589,50 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Setup Node.js
|
||||
id: setup-node
|
||||
if: ${{ !cancelled() && needs.maybe-release.outputs.core_changed && steps.build-lib.outcome == 'success' }}
|
||||
uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Setup Python
|
||||
id: setup-python
|
||||
if: ${{ !cancelled() && steps.setup-node.outcome == 'success' }}
|
||||
uses: actions/setup-python@v7
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Build simplex-chat (npm) and add-on
|
||||
id: build-nodejs
|
||||
if: ${{ !cancelled() && steps.setup-python.outcome == 'success' }}
|
||||
shell: bash
|
||||
working-directory: packages/simplex-chat-nodejs
|
||||
run: |
|
||||
(cd ../simplex-chat-client/types/typescript && npm install --no-audit --no-fund && npx tsc)
|
||||
npm install --ignore-scripts --no-save --no-audit --no-fund ../simplex-chat-client/types/typescript
|
||||
npx --yes node-gyp rebuild
|
||||
npx tsc && cp src/simplex.* dist
|
||||
|
||||
- name: Test simplex-chat (npm)
|
||||
id: test-nodejs
|
||||
if: ${{ !cancelled() && steps.build-nodejs.outcome == 'success' }}
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
working-directory: packages/simplex-chat-nodejs
|
||||
env:
|
||||
SIMPLEX_LIBS_DIR: ${{ github.workspace }}/release-libs/simplex-chat-libs-linux-${{ matrix.arch }}/libs
|
||||
run: npx jest --forceExit --testNamePattern '^(?!.*use preset servers)'
|
||||
|
||||
- name: Test simplex-chat (PyPI)
|
||||
if: ${{ !cancelled() && steps.test-nodejs.outcome == 'success' }}
|
||||
timeout-minutes: 30
|
||||
shell: bash
|
||||
working-directory: packages/simplex-chat-python
|
||||
run: |
|
||||
python -m pip install -e ".[test]"
|
||||
python -m pytest -q
|
||||
|
||||
- name: Remove -O2 build directory
|
||||
id: remove-o2
|
||||
if: env.cache_o0 == 'true' && !cancelled() && steps.build-cli.outcome == 'success'
|
||||
@@ -657,6 +678,40 @@ jobs:
|
||||
!dist-newstyle/src
|
||||
key: ${{ steps.keys.outputs.dist }}-O0-${{ env.branch }}-${{ github.sha }}
|
||||
|
||||
build-linux-push:
|
||||
name: "ubuntu-${{ matrix.os }}-${{ matrix.arch }} (CLI,Desktop), GHC: ${{ matrix.ghc }}"
|
||||
needs: [maybe-release, variables]
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: ${{ matrix.runner }}
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
env:
|
||||
image_cache: ghcr.io/simplex-chat/simplex-chat-build-cache:${{ matrix.os }}-${{ matrix.arch }}-ghc${{ matrix.ghc }}
|
||||
source_hashes: dist-newstyle/sources.sha256
|
||||
cache_o0: false
|
||||
concurrency: *linux-concurrency
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: 22.04
|
||||
os_underscore: 22_04
|
||||
arch: aarch64
|
||||
runner: "ubuntu-22.04-arm"
|
||||
should_run: true
|
||||
ghc: ${{ needs.variables.outputs.GHC_VER }}
|
||||
hash: 'sha256:6a62a4157b8775eaf4959cb629e757d32d39d1f4c8ac1b0ddc2510b555cf72f3'
|
||||
libs: true
|
||||
- os: 24.04
|
||||
os_underscore: 24_04
|
||||
arch: aarch64
|
||||
runner: "ubuntu-24.04-arm"
|
||||
should_run: true
|
||||
ghc: ${{ needs.variables.outputs.GHC_VER }}
|
||||
hash: 'sha256:68434214381cb38287104e629fe8ee720167dd98cbb36ab1cbbab342515fa6ab'
|
||||
steps: *linux-steps
|
||||
|
||||
# =================================
|
||||
# Linux PostgreSQL Library Build
|
||||
# =================================
|
||||
@@ -783,7 +838,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-macos-${{ matrix.os }}-${{ needs.maybe-release.outputs.libs_tag }}
|
||||
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') && !needs.maybe-release.outputs.libs_tag }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -1082,7 +1137,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-windows-${{ matrix.os }}-${{ needs.maybe-release.outputs.libs_tag }}
|
||||
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') && !needs.maybe-release.outputs.libs_tag }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -1338,7 +1393,7 @@ jobs:
|
||||
# A new library release is tested with the Node.js and Python packages and updates them in a release PR.
|
||||
|
||||
packages:
|
||||
needs: [maybe-release, build-linux, build-linux-postgres, build-macos, build-windows]
|
||||
needs: [maybe-release, build-linux, build-linux-push, build-linux-postgres, build-macos, build-windows]
|
||||
if: ${{ !cancelled() && needs.maybe-release.outputs.libs_tag }}
|
||||
# the called workflow can't be granted more than its caller, and its publish job needs these
|
||||
permissions:
|
||||
@@ -1348,16 +1403,3 @@ jobs:
|
||||
with:
|
||||
libs_release: ${{ needs.maybe-release.outputs.libs_tag }}
|
||||
secrets: inherit
|
||||
|
||||
# A pull request that changes the chat core is tested with the Node.js and Python packages.
|
||||
|
||||
packages-pr:
|
||||
needs: [maybe-release, build-linux]
|
||||
# build-linux uploads the library before its chat tests run
|
||||
if: ${{ !cancelled() && needs.maybe-release.outputs.core_changed }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
uses: ./.github/workflows/packages.yml
|
||||
with:
|
||||
libs_artifact: true
|
||||
@@ -39,13 +39,9 @@ on:
|
||||
python_version:
|
||||
description: "simplex-chat PyPI version, bumped when needed by default"
|
||||
required: false
|
||||
# build.yml: a pull request that changes the chat core, or a new library release
|
||||
# build.yml: a new library release
|
||||
workflow_call:
|
||||
inputs:
|
||||
libs_artifact:
|
||||
description: "test with simplex-chat-libs-linux-x86_64 built by the calling run"
|
||||
type: boolean
|
||||
default: false
|
||||
libs_release:
|
||||
description: "test with this simplex-chat-libs release"
|
||||
type: string
|
||||
@@ -119,12 +115,11 @@ jobs:
|
||||
EVENT: ${{ github.event_name }}
|
||||
BASE: ${{ github.event.pull_request.base.sha }}
|
||||
RELEASE_MISSING: ${{ steps.release.outputs.missing }}
|
||||
LIBS_ARTIFACT: ${{ inputs.libs_artifact }}
|
||||
LIBS_RELEASE: ${{ inputs.libs_release }}
|
||||
run: |
|
||||
if [ -n "$BASE" ]; then git fetch -q --depth=1 origin "$BASE"; fi
|
||||
python3 scripts/ci/packages_release.py build-plan --event "$EVENT" --base "$BASE" \
|
||||
--release-missing "$RELEASE_MISSING" --libs-artifact "$LIBS_ARTIFACT" --libs-release "$LIBS_RELEASE" >> "$GITHUB_OUTPUT"
|
||||
--release-missing "$RELEASE_MISSING" --libs-release "$LIBS_RELEASE" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build:
|
||||
name: "build ${{ matrix.platform }}"
|
||||
@@ -163,13 +158,6 @@ jobs:
|
||||
npx tsc && cp src/simplex.* dist
|
||||
cp build/Release/simplex.node build/simplex-chat-nodejs-${{ matrix.platform }}.node
|
||||
|
||||
- name: Download libsimplex of this run
|
||||
if: needs.addon.outputs.test && inputs.libs_artifact
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: simplex-chat-libs-${{ matrix.platform }}
|
||||
path: ${{ runner.temp }}/libsimplex
|
||||
|
||||
- name: Download libsimplex release
|
||||
if: needs.addon.outputs.test && inputs.libs_release
|
||||
env:
|
||||
@@ -177,13 +165,13 @@ jobs:
|
||||
run: curl -fsSL --create-dirs -o "$RUNNER_TEMP/libsimplex/simplex-chat-libs-${{ matrix.platform }}.zip" "$URL"
|
||||
|
||||
- name: Unpack libsimplex
|
||||
if: needs.addon.outputs.test && (inputs.libs_artifact || inputs.libs_release)
|
||||
if: needs.addon.outputs.test && inputs.libs_release
|
||||
run: python -m zipfile -e "$RUNNER_TEMP/libsimplex/simplex-chat-libs-${{ matrix.platform }}.zip" "$RUNNER_TEMP/libsimplex"
|
||||
|
||||
- name: Test simplex-chat (npm)
|
||||
if: needs.addon.outputs.test
|
||||
env:
|
||||
SIMPLEX_LIBS_DIR: ${{ (inputs.libs_artifact || inputs.libs_release) && format('{0}/libsimplex/libs', runner.temp) || '' }}
|
||||
SIMPLEX_LIBS_DIR: ${{ inputs.libs_release && format('{0}/libsimplex/libs', runner.temp) || '' }}
|
||||
# A failed test can leave chat controllers running, and jest then waits for them.
|
||||
# Tests on the public preset servers fail in CI when a server is slow to connect.
|
||||
run: npx jest --forceExit --testNamePattern '^(?!.*use preset servers)'
|
||||
|
||||
Reference in new issue
Block a user