CI #748
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: '00 02 */4 * *' | |
env: | |
RUST_BACKTRACE: 1 | |
CLC_STABLE_HASH: "aecd4740aafb180c24f25de6c4188f39eb530c46" | |
jobs: | |
rust-tests: | |
name: Rust tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-13] | |
rust: [stable, beta] | |
env: | |
RUSTUP_MAX_RETRIES: 10 | |
CARGO_NET_RETRY: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout couchbase-lite-core | |
uses: actions/checkout@v4 | |
with: | |
repository: 'dushistov/couchbase-lite-core' | |
ref: ${{ env.CLC_STABLE_HASH }} | |
submodules: 'recursive' | |
path: 'couchbase-lite-core' | |
- name: Export path to c++ library | |
run: | | |
echo "CORE_SRC=$GITHUB_WORKSPACE/couchbase-lite-core" >> $GITHUB_ENV | |
# We need to disable the existing toolchain to avoid updating rust-docs | |
# which takes a long time. The fastest way to do this is to rename the | |
# existing folder, as deleting it takes about as much time as not doing | |
# anything and just updating rust-docs. | |
- name: Rename existing rust toolchain (Windows) | |
if: matrix.os == 'windows-latest' | |
run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8.2' | |
- uses: jwlawson/[email protected] | |
with: | |
cmake-version: '3.21.x' | |
github-api-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install llvm tools on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
set -e | |
curl https://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe -o llvm-installer.exe | |
7z x llvm-installer.exe -oc:\\llvm-binary | |
echo "LIBCLANG_PATH=C:\\llvm-binary\\bin" >> $GITHUB_ENV | |
echo "c:\\llvm-binary\\bin" >> $GITHUB_PATH | |
shell: bash | |
- name: Check versions | |
run: | | |
set -e | |
cargo --version | |
rustc --version | |
python --version | |
cmake --version | |
echo "end of versions checking" | |
shell: bash | |
- name: Run tests | |
run: | | |
set -e | |
cd $GITHUB_WORKSPACE | |
python ci/build_and_run_tests.py --rust-only | |
shell: bash | |
- name: Run tests with valgrind | |
if: matrix.os == 'ubuntu-20.04' && matrix.rust == 'stable' | |
run: | | |
set -e | |
cat /etc/issue | |
curl -L https://github.com/Dushistov/valgrind/releases/download/dwarf5-fix1/valgrind-git-bin-18072022.tar.bz2 -o valgrind-git-bin.tar.bz2 | |
sudo tar -xjvpf valgrind-git-bin.tar.bz2 -C / | |
sudo apt-get update -y | |
sudo apt-get install -y libc6-dbg | |
valgrind --version | |
cargo install cargo-valgrind | |
python ci/build_and_run_tests.py --rust-only-with-valigrind | |
shell: bash | |
ios-tests: | |
name: Check work with iOS | |
runs-on: macos-13 | |
strategy: | |
fail-fast: true | |
matrix: | |
rust: [stable, beta] | |
env: | |
RUSTUP_MAX_RETRIES: 10 | |
CARGO_NET_RETRY: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout couchbase-lite-core | |
uses: actions/checkout@v4 | |
with: | |
repository: 'dushistov/couchbase-lite-core' | |
ref: ${{ env.CLC_STABLE_HASH }} | |
submodules: 'recursive' | |
path: 'couchbase-lite-core' | |
- name: Export path to c++ library | |
run: | | |
echo "CORE_SRC=$GITHUB_WORKSPACE/couchbase-lite-core" >> $GITHUB_ENV | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
target: "aarch64-apple-ios" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8.2' | |
- uses: jwlawson/[email protected] | |
with: | |
cmake-version: '3.21.x' | |
github-api-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check versions | |
run: | | |
set -e | |
cargo --version | |
rustc --version | |
python --version | |
cmake --version | |
echo "end of versions checking" | |
shell: bash | |
- name: Run tests | |
run: | | |
set -e | |
cd $GITHUB_WORKSPACE | |
python ci/build_and_run_tests.py --rust-ios-only | |
shell: bash | |
# Rebuild C++ part here, because of in build.rs we don't build unit tests | |
cpp-tests: | |
name: C++ tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-13] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout couchbase-lite-core | |
uses: actions/checkout@v4 | |
with: | |
repository: 'dushistov/couchbase-lite-core' | |
ref: ${{ env.CLC_STABLE_HASH }} | |
submodules: 'recursive' | |
path: 'couchbase-lite-core' | |
- name: Export path to c++ library | |
run: | | |
echo "CORE_SRC=$GITHUB_WORKSPACE/couchbase-lite-core" >> $GITHUB_ENV | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8.2' | |
- uses: jwlawson/[email protected] | |
with: | |
cmake-version: '3.21.x' | |
github-api-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add fr_FR locale | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
set -e | |
sudo locale-gen fr_FR | |
sudo update-locale | |
shell: bash | |
- name: Run tests | |
run: | | |
set -e | |
cd $GITHUB_WORKSPACE | |
python ci/build_and_run_tests.py --cpp-only | |
shell: bash | |
# Detect cases where documentation links don't resolve and such. | |
nightly-only-tools: | |
name: Checks with rustc/nightly | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout couchbase-lite-core | |
uses: actions/checkout@v4 | |
with: | |
repository: 'dushistov/couchbase-lite-core' | |
ref: ${{ env.CLC_STABLE_HASH }} | |
submodules: 'recursive' | |
path: 'couchbase-lite-core' | |
- name: Export path to c++ library | |
run: | | |
echo "COUCHBASE_LITE_CORE_SRC_DIR=$GITHUB_WORKSPACE/couchbase-lite-core" >> $GITHUB_ENV | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
# Docs.rs uses nightly, which allows for easier syntax for linking to functions. | |
toolchain: nightly | |
override: true | |
components: rust-src,rustfmt,clippy | |
- name: rustdoc for couchbase-lite | |
run: cargo rustdoc -p couchbase-lite --no-default-features --features="build-cpp,use-couchbase-lite-sqlite,use-tokio-websocket,use-native-tls" -- -D warnings | |
- name: rustdoc for couchbase-lite-core-sys | |
run: cargo rustdoc -p couchbase-lite-core-sys --no-default-features --features="build,use-couchbase-lite-sqlite" -- -D warnings | |
- name: Tests with asan | |
env: | |
RUSTFLAGS: -Zsanitizer=address -Cdebuginfo=0 | |
RUSTDOCFLAGS: -Zsanitizer=address | |
ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_leaks=0" | |
# Work around https://github.com/rust-lang/rust/issues/59125 by | |
# disabling backtraces. In an ideal world we'd probably suppress the | |
# leak sanitization, but we don't care about backtraces here, so long | |
# as the other tests have them. | |
RUST_BACKTRACE: "0" | |
run: cargo -Z build-std test --no-default-features --features="build-cpp,use-couchbase-lite-sqlite,use-tokio-websocket,use-native-tls,with-asan" --target x86_64-unknown-linux-gnu |