Skip to content

Commit

Permalink
Merge pull request #20 from gluonhq/patch-v0.62.0
Browse files Browse the repository at this point in the history
Patch v0.62.0
  • Loading branch information
tiainen authored Nov 22, 2024
2 parents 82dde22 + 116f11d commit d58c28b
Show file tree
Hide file tree
Showing 676 changed files with 56,829 additions and 18,602 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ acknowledgments/acknowledgments.*.hbs merge text=auto
# Treat encrypted and unencrypted message backup files as binary
**/*.binproto binary
**/*.binproto.encrypted binary

# Avoid Windows line-endings for files compared literally.
**/*.expected.json text eol=lf
18 changes: 18 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Notes on GitHub Actions

## Why not use `actions/cache` in the Rust jobs?

In Sep 2024, the slowest part of `build_and_test.yml` was the main Rust job, which runs several Rust-related checks---some using our pinned nightly, others using our MSRV, and still others with both toolchains. The slowest *parts* of the job are just building things, and that's at least partly because each step requires slightly different configurations, making the rebuilds less incremental than they might otherwise be. The second slowest job is the Java one, which builds the main library in several slices.

It might be reasonable to try to cache some of this work, either using [`actions/cache`][] directly or another action built on top of it like [`Swatinem/rust-cache`][]. However, it's not clear how much of a benefit we'll actually get:

- Turning off `CARGO_INCREMENTAL` (as suggested by `rust-cache`) would save some space in our target directories, but we actually do build our local crates in a few different configurations, so we might make builds longer if we do that.

- Fetching dependencies takes about 1m out of our total time, not enough to be worth targeting specifically.

- We build with two different Rust toolchains, so any caching we do is doubled. The Java build only uses one toolchain, but it builds release instead of debug, and does multiple slices. If we fill up our entire cache quota (10GB) by accident, we lose most of the benefits as each job's cache evicts one of the other ones.

- Building with a lower debug info setting might save on the space of build intermediates, but is then testing something different than what people usually use at their desk.

[`actions/cache`]: https://github.com/actions/cache
[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache
48 changes: 22 additions & 26 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:

env:
CARGO_TERM_COLOR: always
NDK_VERSION: 25.2.9519653
NDK_VERSION: 27.0.12077973
RUST_BACKTRACE: 1
LIBSIGNAL_MINIMUM_SUPPORTED_RUST_VERSION: 1.72
LIBSIGNAL_MINIMUM_SUPPORTED_RUST_VERSION: 1.75
# For dev builds, include limited debug info in the output. See
# https://doc.rust-lang.org/cargo/reference/profiles.html#debug
CARGO_PROFILE_DEV_DEBUG: limited
Expand Down Expand Up @@ -188,12 +188,6 @@ jobs:
run: cargo clippy --workspace --all-targets --all-features ${{ matrix.cargo-keep-going }} -- -D warnings
if: matrix.version == 'nightly'

- name: cargo clean (reclaim disk space)
# Clean the contents of the target directory to avoid running out of disk space during the
# doc build.
run: cargo clean
if: matrix.version == 'stable'

- name: Rust docs
run: cargo +${{ matrix.toolchain }} doc --workspace --all-features ${{ matrix.cargo-keep-going }}
if: matrix.version == 'stable'
Expand All @@ -204,12 +198,6 @@ jobs:
# and crates don't generally support arbitrary nightly versions.
# See https://github.com/dtolnay/proc-macro2/issues/307 for an example.

- name: cargo clean (reclaim disk space)
# Clean the contents of the target directory to avoid running out of disk space during the
# following steps.
run: cargo clean
if: matrix.version == 'stable'

- name: Check that the protocol fuzz target still builds
run: cargo +${{ matrix.toolchain }} check --all-targets ${{ matrix.cargo-keep-going }}
working-directory: rust/protocol/fuzz
Expand Down Expand Up @@ -288,6 +276,8 @@ jobs:

- run: sudo apt-get update && sudo apt-get install protobuf-compiler

- run: cargo +stable install cbindgen

- run: rustup toolchain install $(cat rust-toolchain) --profile minimal --target aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android,i686-linux-android

- name: Install Protoc
Expand All @@ -299,18 +289,20 @@ jobs:
- name: Verify that the JNI bindings are up to date
run: rust/bridge/jni/bin/gen_java_decl.py --verify

- run: ./gradlew build assembleDebugAndroidTest android:lintDebug -PandroidArchs=arm,arm64 -PandroidTestingArchs=x86_64 | tee ./gradle-output.txt
- run: ./gradlew build assembleDebugAndroidTest android:lintDebug -PandroidArchs=arm,arm64 | tee ./gradle-output.txt
working-directory: java
shell: bash # Explicitly setting the shell turns on pipefail in GitHub Actions

# Check for -Xcheck:jni warnings manually; Gradle doesn't capture them for some reason.
- run: "! grep WARNING ./gradle-output.txt"
working-directory: java

- run: java/check_code_size.py
- run: java/check_code_size.py | tee ./check_code_size-output.txt
env:
GH_TOKEN: ${{ github.token }}

- run: grep -v -F '***' ./check_code_size-output.txt >> $GITHUB_STEP_SUMMARY

node:
name: Node

Expand Down Expand Up @@ -356,24 +348,24 @@ jobs:
run: rust/bridge/node/bin/gen_ts_decl.py --verify
if: matrix.os == 'ubuntu-20.04'

- run: yarn install --frozen-lockfile
- run: npm ci
working-directory: node

- run: yarn node-gyp rebuild
- run: npx node-gyp rebuild
working-directory: node

- run: yarn tsc
- run: npm run tsc
working-directory: node

- run: yarn lint
- run: npm run lint
if: matrix.os == 'ubuntu-20.04'
working-directory: node

- run: yarn format -c
- run: npm run format -c
if: matrix.os == 'ubuntu-20.04'
working-directory: node

- run: yarn test
- run: npm run test
working-directory: node

swift_package:
Expand All @@ -396,6 +388,8 @@ jobs:

- run: sudo apt-get update && sudo apt-get install protobuf-compiler

- run: cargo +stable install cbindgen

- run: swift/verify_error_codes.sh

- name: Build libsignal-ffi
Expand All @@ -409,14 +403,16 @@ jobs:
run: swift run -v Benchmarks --allow-debug-build
working-directory: swift/Benchmarks

- name: Build Swift package documentation
run: swift package plugin generate-documentation --analyze --warnings-as-errors
working-directory: swift
# Disabled for now, broken on Linux in the Swift 6.0 release.
# See https://forums.swift.org/t/generate-documentation-failing-for-swift-6-pre-release/74534
# - name: Build Swift package documentation
# run: swift package plugin generate-documentation --analyze --warnings-as-errors
# working-directory: swift

swift_cocoapod:
name: Swift CocoaPod

runs-on: macOS-12
runs-on: macos-latest

needs: changes

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# Needed for google-github-actions/auth.
id-token: 'write'

runs-on: macos-12
runs-on: macos-latest

timeout-minutes: 45

Expand Down
99 changes: 59 additions & 40 deletions .github/workflows/jni_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ jobs:

strategy:
matrix:
os: [windows-latest, macos-12]
os: [windows-latest, macos-latest]
include:
- os: windows-latest
library: signal_jni.dll
- os: macos-12
library: libsignal_jni.dylib
additional-rust-target: aarch64-apple-darwin
- os: macos-latest
additional-rust-target: x86_64-apple-darwin
# Ubuntu binaries are built using Docker, below

timeout-minutes: 45
Expand Down Expand Up @@ -72,47 +70,63 @@ jobs:
if: matrix.os == 'windows-latest'

- run: brew install protobuf
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-latest'

- name: Build for host (should be x86_64)
- name: Build client for host
run: java/build_jni.sh desktop
shell: bash

- name: Build for alternate target (arm64)
- name: Build server for host
run: java/build_jni.sh server
shell: bash

- name: Build client for alternate target
run: java/build_jni.sh desktop
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-latest'
env:
CARGO_BUILD_TARGET: ${{ matrix.additional-rust-target }}

- name: Build server for alternate target
run: java/build_jni.sh server
if: matrix.os == 'macos-latest'
env:
CARGO_BUILD_TARGET: ${{ matrix.additional-rust-target }}

- name: Merge library slices (for macOS)
# Using target/release/ for both the input and output wouldn't normally be ideal
# from a build system perspective, but we're going to immediately upload the merged library.
run: lipo -create target/release/${{ matrix.library }} target/${{ matrix.additional-rust-target }}/release/${{ matrix.library }} -output target/release/${{ matrix.library }}
if: matrix.os == 'macos-12'
- name: Upload client libraries
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: libsignal-client libraries (${{matrix.os}})
path: |
java/client/src/main/resources/*.dll
java/client/src/main/resources/*.dylib
- name: Upload library
- name: Upload server libraries
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: libsignal_jni (${{matrix.os}})
path: target/release/${{ matrix.library }}

# verify-rust:
# name: Verify JNI bindings
# runs-on: ubuntu-latest
#
# timeout-minutes: 45
#
# steps:
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# with:
# submodules: recursive
#
# - run: rustup toolchain install $(cat rust-toolchain) --profile minimal
#
# - run: sudo apt-get update && sudo apt-get install protobuf-compiler
#
# - name: Verify that the JNI bindings are up to date
# run: rust/bridge/jni/bin/gen_java_decl.py --verify
name: libsignal-server libraries (${{matrix.os}})
path: |
java/server/src/main/resources/*.dll
java/server/src/main/resources/*.dylib
# verify-rust:
# name: Verify JNI bindings
# runs-on: ubuntu-latest

# timeout-minutes: 45

# steps:
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# with:
# submodules: recursive

# - run: rustup toolchain install $(cat rust-toolchain) --profile minimal

# - run: sudo apt-get update && sudo apt-get install protobuf-compiler

# - run: cargo +stable install cbindgen

# - name: Verify that the JNI bindings are up to date
# run: rust/bridge/jni/bin/gen_java_decl.py --verify

publish:
name: Build for production and publish
Expand All @@ -128,14 +142,19 @@ jobs:
with:
submodules: recursive

- name: Download built libraries
id: download
- name: Download built client libraries
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
path: artifacts
path: java/client/src/main/resources
pattern: libsignal-client*
merge-multiple: true

- name: Copy libraries
run: mv ${{ steps.download.outputs.download-path }}/*/* java/shared/resources && find java/shared/resources
- name: Download built server libraries
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
path: java/server/src/main/resources
pattern: libsignal-server*
merge-multiple: true

- name: Install Protoc
uses: arduino/setup-protoc@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
- run: pip3 install flake8 mypy
- run: sudo apt-get update && sudo apt-get install python3-flake8 python3-mypy
- run: shellcheck **/*.sh bin/verify_duplicate_crates bin/adb-run-test
- run: python3 -m flake8 .
- run: python3 -m mypy . --python-version 3.9 --strict
Loading

0 comments on commit d58c28b

Please sign in to comment.