Files
libsignal/.github/workflows/build_and_test.yml
Jordan Rose 0542686e70 Update artifact/package/module names across all three app languages
- Java: org.whispersystems:signal-client-java ->
    org.signal:libsignal-client
- Java: org.whispersystems:signal-client-android ->
    org.signal:libsignal-android
- Java: org.whispersystems:libsignal-server ->
    org.signal:libsignal-server
- Swift: SignalClient -> LibSignalClient
- NPM: @signalapp/signal-client -> @signalapp/libsignal-client
- Repository: github.com/signalapp/libsignal-client ->
    github.com/signalapp/libsignal
2022-03-23 10:49:09 -07:00

318 lines
8.3 KiB
YAML

name: Build and Test
on:
push:
branches: [ main ]
pull_request: # all target branches
env:
CARGO_TERM_COLOR: always
jobs:
changes:
name: Classify changes
runs-on: ubuntu-latest
outputs:
rust: ${{ steps.filter.outputs.rust }}
java: ${{ steps.filter.outputs.java }}
node: ${{ steps.filter.outputs.node }}
swift: ${{ steps.filter.outputs.swift }}
rust_ios: ${{ steps.filter.outputs.rust_ios }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
all: &all
- '.github/workflows/build_and_test.yml'
- 'bin/**'
- 'rust/*'
- 'rust/!(bridge)/**'
- 'rust/bridge/shared/**'
- 'rust-toolchain'
- 'Cargo.toml'
- 'Cargo.lock'
rust:
- *all
- '.clippy.toml'
- '.rustfmt.license-template'
- '.rustfmt.toml'
- 'rust/**' # deliberately re-include the rust/bridge/ directories
java:
- *all
- '.dockerignore'
- 'java/**'
- 'rust/bridge/jni/**'
node:
- *all
- '.nvmrc'
- '.prettierrc.js'
- 'node/**'
- 'rust/bridge/node/**'
rust_ios: &rust_ios
- *all
- 'rust/bridge/ffi/**'
swift:
- *rust_ios
- 'swift/**'
- 'LibSignalClient.podspec'
ignored:
- 'LICENSE'
- '*.md'
- '.github/FUNDING.yml'
- '.github/workflows/**'
- '.gitignore'
- name: Check pattern completeness
run: echo "::error file=.github/workflows/build_and_test.yml::File not included in any filter" && false
if: ${{ !contains(steps.filter.outputs.*, 'true') }}
rust-stable:
name: Rust stable
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
steps:
- uses: actions/checkout@v2
- run: sudo apt-get update && sudo apt-get install gcc-multilib
- name: Install Rust
run: rustup +stable target add i686-unknown-linux-gnu
- name: Build
run: cargo +stable build --verbose
- name: Run tests
run: cargo +stable test --workspace --verbose -- --include-ignored
- name: Run tests (32-bit)
# Exclude device-transfer because OpenSSL, used for reference results,
# doesn't support the --target option.
# Exclude signal-neon-futures because those tests run Node
run: cargo +stable test --workspace --verbose --target i686-unknown-linux-gnu --exclude device-transfer --exclude signal-neon-futures -- --include-ignored
- name: Build benches
run: cargo +stable build --workspace --benches --verbose
- name: Check that the fuzz target still builds
# We do this on stable because the fuzz target doesn't have a lockfile,
# and crates don't generally support arbitrary nightly versions.
# See https://github.com/dtolnay/proc-macro2/issues/307 for an example.
run: cargo +stable check --all-targets
working-directory: rust/protocol/fuzz
env:
RUSTFLAGS: --cfg fuzzing
rust-nightly:
name: Rust nightly
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
steps:
- uses: actions/checkout@v2
- run: sudo apt-get update && sudo apt-get install gcc-multilib
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustfmt, clippy
target: i686-unknown-linux-gnu
# This should be done before anything else
# because it also checks that the lockfile is up to date.
- name: Check for duplicate dependencies
run: ./bin/verify_duplicate_crates
- name: Rustfmt check
run: cargo fmt --all -- --check
- name: Check bridge versioning
run: ./bin/update_versions.py
- name: Build
run: cargo build --all --verbose
- name: Run tests
run: cargo test --all --verbose -- -Z unstable-options --include-ignored
- name: Run tests (32-bit)
# Exclude device-transfer because OpenSSL, used for reference results,
# doesn't support the --target option.
# Exclude signal-neon-futures because those tests run Node
run: cargo test --all --verbose --target i686-unknown-linux-gnu --exclude device-transfer --exclude signal-neon-futures -- -Z unstable-options --include-ignored
- name: Build benches
run: cargo build --benches --verbose
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
java:
name: Java
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.java == 'true' }}
steps:
- uses: actions/checkout@v2
- name: Install NDK 21.0.6113669
run: sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
- name: Install Android toolchains
run: rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
- name: Install NDK tool
run: cargo install --version=1.0.0 cargo-ndk
- name: Verify that the JNI bindings are up to date
run: rust/bridge/jni/bin/gen_java_decl.py --verify
- run: ./gradlew build
working-directory: java
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk-bundle
- run: java/check_code_size.py
node:
name: Node
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
needs: changes
if: ${{ needs.changes.outputs.node == 'true' }}
steps:
- uses: actions/checkout@v2
- name: Install nightly rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
- name: Get Node version from .nvmrc
id: get-nvm-version
shell: bash
run: echo "::set-output name=node-version::$(cat .nvmrc)"
- uses: actions/setup-node@v2
with:
node-version: ${{ steps.get-nvm-version.outputs.node-version }}
- name: Verify that the Node bindings are up to date
run: rust/bridge/node/bin/gen_ts_decl.py --verify
if: matrix.os == 'ubuntu-latest'
- run: yarn install --frozen-lockfile
working-directory: node
- run: yarn tsc
working-directory: node
- run: yarn lint
if: matrix.os == 'ubuntu-latest'
working-directory: node
- run: yarn format -c
if: matrix.os == 'ubuntu-latest'
working-directory: node
- name: Run yarn test
uses: GabrielBB/xvfb-action@v1.4
with:
# The tests use an Electron-based runner, so we need to set up a dummy display for them.
run: yarn test
working-directory: node
swift_package:
name: Swift Package
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.swift == 'true' }}
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
- name: Build libsignal-ffi
run: swift/build_ffi.sh -d -v --verify-ffi
- name: Build Swift and run tests
run: swift test -v
working-directory: swift
swift_cocoapod:
name: Swift CocoaPod
runs-on: macOS-latest
needs: changes
if: ${{ needs.changes.outputs.swift == 'true' }}
steps:
- uses: actions/checkout@v2
- name: Run lint
run: swiftlint lint --strict --reporter github-actions-logging
working-directory: swift
- name: Check out SignalCoreKit
uses: actions/checkout@v2
with:
repository: signalapp/SignalCoreKit
path: SignalCoreKit
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rust-src
- name: Add iOS targets
run: rustup target add x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
- name: Run pod lint
# No import validation because it tries to build unsupported platforms (like 32-bit iOS).
run: pod lib lint --verbose --platforms=ios --include-podspecs=SignalCoreKit/SignalCoreKit.podspec --skip-import-validation
env:
XCODE_XCCONFIG_FILE: swift/PodLibLint.xcconfig