Merge branch 'stable' into stable-android-new

# Conflicts:
#	.github/workflows/build.yml
#	flake.nix
#	scripts/desktop/build-lib-linux.sh
This commit is contained in:
shum
2026-05-26 07:19:23 +00:00
1341 changed files with 167737 additions and 18892 deletions
+239 -14
View File
@@ -10,17 +10,25 @@ on:
- "!*-fdroid"
- "!*-armv7a"
pull_request:
paths-ignore:
- "apps/ios"
- "apps/multiplatform"
- "blog"
- "docs"
- "fastlane"
- "images"
- "packages"
- "website"
- "README.md"
- "PRIVACY.md"
paths:
- "src/**"
- "apps/simplex-chat/**"
- "apps/simplex-bot/**"
- "apps/simplex-bot-advanced/**"
- "apps/simplex-broadcast-bot/**"
- "apps/simplex-directory-service/**"
- "tests/**"
- "bots/src/**"
- "simplex-chat.cabal"
- "cabal.project"
- "Dockerfile*"
- "scripts/ci/**"
- "scripts/desktop/**"
- ".github/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') }}
# This workflow uses custom actions (prepare-build and prepare-release) defined in:
#
@@ -111,6 +119,7 @@ jobs:
arch: x86_64
runner: "ubuntu-22.04"
ghc: "8.10.7"
hash: 'sha256:5c8b2c0a6c745bc177669abfaa716b4bc57d58e2ea3882fb5da67f4d59e3dda5'
should_run: ${{ !(github.ref == 'refs/heads/stable' || startsWith(github.ref, 'refs/tags/v')) }}
- os: 22.04
os_underscore: 22_04
@@ -118,24 +127,28 @@ jobs:
runner: "ubuntu-22.04"
should_run: true
ghc: ${{ needs.variables.outputs.GHC_VER }}
hash: 'sha256:5c8b2c0a6c745bc177669abfaa716b4bc57d58e2ea3882fb5da67f4d59e3dda5'
- os: 24.04
os_underscore: 24_04
arch: x86_64
runner: "ubuntu-24.04"
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'
- 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:
- name: Checkout Code
if: matrix.should_run == true
@@ -147,6 +160,12 @@ jobs:
with:
swap-size-gb: 30
- name: Get UID and GID
id: ids
run: |
echo "uid=$(id -u)" >> $GITHUB_OUTPUT
echo "gid=$(id -g)" >> $GITHUB_OUTPUT
# Otherwise we run out of disk space with Docker build
- name: Free disk space
if: matrix.should_run == true
@@ -176,7 +195,10 @@ jobs:
tags: build/${{ matrix.os }}:latest
build-args: |
TAG=${{ matrix.os }}
HASH=${{ matrix.hash }}
GHC=${{ matrix.ghc }}
USER_UID=${{ steps.ids.outputs.uid }}
USER_GID=${{ steps.ids.outputs.gid }}
# Docker needs these flags for AppImage build:
# --device /dev/fuse
@@ -209,7 +231,6 @@ jobs:
if: matrix.should_run == true
shell: docker exec -t builder sh -eu {0}
run: |
chmod -R 777 dist-newstyle ~/.cabal && git config --global --add safe.directory '*'
cabal clean
cabal update
cabal build -j --enable-tests
@@ -281,6 +302,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') && matrix.should_run == true
shell: docker exec -t builder sh -eu {0}
run: |
export ASSETS_DIR='../../assets'
scripts/desktop/make-deb-linux.sh
- name: Prepare Desktop
@@ -306,6 +328,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == '22.04' && matrix.should_run == true
shell: docker exec -t builder sh -eu {0}
run: |
export ASSETS_DIR='../../assets'
scripts/desktop/make-appimage-linux.sh
- name: Prepare AppImage
@@ -356,6 +379,100 @@ jobs:
exit 1
fi
# =================================
# Linux PostgreSQL Library Build
# =================================
build-linux-postgres:
name: "ubuntu-22.04-x86_64 (Postgres lib), GHC: ${{ needs.variables.outputs.GHC_VER }}"
needs: [maybe-release, variables]
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Get UID and GID
id: ids
run: |
echo "uid=$(id -u)" >> $GITHUB_OUTPUT
echo "gid=$(id -g)" >> $GITHUB_OUTPUT
- name: Free disk space
shell: bash
run: ./scripts/ci/linux_util_free_space.sh
- name: Restore cached build
uses: actions/cache@v4
with:
path: |
~/.cabal/store
dist-newstyle
key: ubuntu-22.04-x86_64-postgres-ghc${{ needs.variables.outputs.GHC_VER }}-${{ hashFiles('cabal.project', 'simplex-chat.cabal') }}
- name: Set up Docker Buildx
uses: simplex-chat/docker-setup-buildx-action@v3
- name: Build and cache Docker image
uses: simplex-chat/docker-build-push-action@v6
with:
context: .
load: true
file: Dockerfile.build
tags: build/22.04:latest
build-args: |
TAG=22.04
HASH=sha256:5c8b2c0a6c745bc177669abfaa716b4bc57d58e2ea3882fb5da67f4d59e3dda5
GHC=${{ needs.variables.outputs.GHC_VER }}
USER_UID=${{ steps.ids.outputs.uid }}
USER_GID=${{ steps.ids.outputs.gid }}
- name: Start container
shell: bash
run: |
docker run -t -d \
--name builder \
-v ~/.cabal:/root/.cabal \
-v /home/runner/work/_temp:/home/runner/work/_temp \
-v ${{ github.workspace }}:/project \
build/22.04:latest
- name: Prepare cabal.project.local
shell: bash
run: |
echo "ignore-project: False" >> cabal.project.local
echo "package direct-sqlcipher" >> cabal.project.local
echo " flags: +openssl" >> cabal.project.local
- name: Build postgres library
shell: docker exec -t builder sh -eu {0}
run: |
cabal clean
cabal update
scripts/desktop/build-lib-linux.sh postgres
- name: Copy libs from container
shell: bash
run: |
ARCH=x86_64
GHC_VER=${{ needs.variables.outputs.GHC_VER }}
BUILD_DIR=$(echo dist-newstyle/build/${ARCH}-linux/ghc-${GHC_VER}/simplex-chat-*)
mkdir -p postgres-libs
cp ${BUILD_DIR}/build/libsimplex.so postgres-libs/
cp ${BUILD_DIR}/build/deps/* postgres-libs/
- name: Upload postgres libs artifact
uses: actions/upload-artifact@v4
with:
name: simplex-libs-linux-postgres-x86_64
path: postgres-libs/
- name: Fix permissions for cache
shell: bash
run: |
sudo chmod -R 777 dist-newstyle ~/.cabal
sudo chown -R $(id -u):$(id -g) dist-newstyle ~/.cabal
# =========================
# MacOS Build
# =========================
@@ -434,7 +551,8 @@ jobs:
APPLE_SIMPLEX_NOTARIZATION_APPLE_ID: ${{ secrets.APPLE_SIMPLEX_NOTARIZATION_APPLE_ID }}
APPLE_SIMPLEX_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_SIMPLEX_NOTARIZATION_PASSWORD }}
run: |
scripts/build-desktop-mac.sh
export ASSETS_DIR='../../assets'
scripts/ci/build-desktop-mac.sh
path=$(echo $PWD/apps/multiplatform/release/main/dmg/SimpleX-*.dmg)
echo "package_path=$path" >> $GITHUB_OUTPUT
echo "package_hash=$(echo SHA2-256\(${{ matrix.desktop_asset_name }}\)= $(openssl sha256 $path | cut -d' ' -f 2))" >> $GITHUB_OUTPUT
@@ -560,7 +678,7 @@ jobs:
export PATH=$PATH:/c/ghcup/bin:$(echo /c/tools/ghc-*/bin || echo)
scripts/desktop/build-lib-windows.sh
cd apps/multiplatform
./gradlew packageMsi
./gradlew -Psimplex.assets.dir=../../assets packageMsi
rm -rf dist-newstyle/src/direct-sq*
path=$(echo $PWD/release/main/msi/*imple*.msi | sed 's#/\([a-z]\)#\1:#' | sed 's#/#\\#g')
echo "package_path=$path" >> $GITHUB_OUTPUT
@@ -575,3 +693,110 @@ jobs:
bin_hash: ${{ steps.windows_desktop_build.outputs.package_hash }}
github_ref: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# =========================
# NodeJS libs release
# =========================
# Downloads Desktop builds, extracts and archives libraries for NodeJS addon.
# Depends on Linux/MacOS, executes only on release.
# Secrets:
# -------
# NODEJS_REPO_TOKEN
# Only select repositories: simplex-chat-libs
# Permissions:
# * Contents (Read and Write)
release-nodejs-libs:
runs-on: ubuntu-latest
needs: [build-linux, build-linux-postgres, build-macos]
if: startsWith(github.ref, 'refs/tags/v') && (!cancelled())
steps:
- name: Checkout current repository
uses: actions/checkout@v6
- name: Install packages for archiving
run: sudo apt install -y msitools gcc-mingw-w64
- name: Download postgres libs artifact
if: needs.build-linux-postgres.result == 'success'
uses: actions/download-artifact@v4
with:
name: simplex-libs-linux-postgres-x86_64
path: ${{ runner.temp }}/postgres-libs
- name: Build archives
run: |
INIT_DIR='${{ runner.temp }}/artifacts'
RELEASE_DIR='${{ runner.temp }}/release-assets'
TAG='${{ github.ref_name }}'
URL='https://github.com/${{ github.repository }}/releases/download'
PREFIX='${{ github.event.repository.name }}-libs'
# Windows-specific
FILE_URL='https://raw.githubusercontent.com/${{ github.repository }}/refs/tags/${{ github.ref_name }}'
# Setup directories
mkdir "$INIT_DIR" "$RELEASE_DIR" && cd "$INIT_DIR"
# Downlaod desktop release
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-ubuntu-22_04-x86_64.deb" -o linux.deb
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-macos-aarch64.dmg" -o macos-aarch64.dmg
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-macos-x86_64.dmg" -o macos-x86_64.dmg
curl --proto '=https' --tlsv1.2 -sSf -L "${URL}/${TAG}/simplex-desktop-windows-x86_64.msi" -o windows-x86_64.msi
# Linux
# -----
# Extract libraries
dpkg-deb -R linux.deb linux-out/ && cd linux-out/opt/simplex/lib/app/resources
# Preprare directory
mkdir libs && cp *.so libs/
# Archive
zip -r "${PREFIX}-linux-x86_64.zip" libs
# Back to original dir
mv "${PREFIX}-linux-x86_64.zip" "$RELEASE_DIR" && cd "$INIT_DIR"
# MacOS: aarch64
# --------------
7z x macos-aarch64.dmg -omacos1-out/ && cd macos1-out/SimpleX/SimpleX.app/Contents/app/resources/
mkdir libs && cp *.dylib libs/
zip -r "${PREFIX}-macos-aarch64.zip" libs
mv "${PREFIX}-macos-aarch64.zip" "$RELEASE_DIR" && cd "$INIT_DIR"
# Macos: x86_64
# -------------
7z x macos-x86_64.dmg -omacos2-out/ && cd macos2-out/SimpleX/SimpleX.app/Contents/app/resources/
mkdir libs && cp *.dylib libs/
zip -r "${PREFIX}-macos-x86_64.zip" libs
mv "${PREFIX}-macos-x86_64.zip" "$RELEASE_DIR" && cd "$INIT_DIR"
# Windows: x86_64
# ---------------
msiextract windows-x86_64.msi -C windows-out && cd windows-out/SimpleX/app/resources
# We need to generate library that exports symbols from Windows dll
curl --proto '=https' --tlsv1.2 -sSf -LO "${FILE_URL}/libsimplex.dll.def"
x86_64-w64-mingw32-dlltool -d libsimplex.dll.def -l libsimplex.lib -D libsimplex.dll
mkdir libs && cp *.dll *.lib libs/
zip -r "${PREFIX}-windows-x86_64.zip" libs
mv "${PREFIX}-windows-x86_64.zip" "$RELEASE_DIR" && cd "$INIT_DIR"
# Linux PostgreSQL (only if postgres build succeeded)
# -------------------------------------------------
POSTGRES_LIBS='${{ runner.temp }}/postgres-libs'
if [ -d "$POSTGRES_LIBS" ]; then
mkdir -p linux-postgres/libs
cp "${POSTGRES_LIBS}"/*.so linux-postgres/libs/
cd linux-postgres
zip -r "${PREFIX}-linux-x86_64-postgres.zip" libs
mv "${PREFIX}-linux-x86_64-postgres.zip" "$RELEASE_DIR" && cd "$INIT_DIR"
fi
- name: Create release in libs repo and upload artifacts
uses: softprops/action-gh-release@v2
with:
repository: ${{ github.repository }}-libs
tag_name: ${{ github.ref_name }}
files: ${{ runner.temp }}/release-assets/*
token: ${{ secrets.NODEJS_REPO_TOKEN }}