Integration tests #5739
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: Integration tests | |
"on": | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
merge_group: | |
schedule: | |
- cron: '0 2 * * *' # daily @ 02h00 (non-critical) | |
- cron: '0 12 * * 6' # weekly - Saturday @ noon (long-running) | |
workflow_dispatch: | |
inputs: | |
ci_bins: | |
type: boolean | |
default: true | |
description: 'run ci on binaries' | |
ci_ffi: | |
type: boolean | |
default: true | |
description: 'run ci on ffi' | |
ci_profile: | |
default: ci | |
description: 'ci profile to run' | |
type: string | |
env: | |
toolchain: nightly-2024-07-07 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
# cancel-in-progress: true | |
jobs: | |
base_layer: | |
name: Cucumber tests / Base Layer | |
runs-on: [self-hosted, ubuntu-high-cpu] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Envs setup | |
id: envs_setup | |
shell: bash | |
run: | | |
if [ "${{ github.event_name }}" == "schedule" ] ; then | |
echo "CI_FFI=false" >> $GITHUB_ENV | |
if [ "${{ github.event.schedule }}" == "0 2 * * *" ] ; then | |
echo "CI_PROFILE=(not @long-running)" >> $GITHUB_ENV | |
elif [ "${{ github.event.schedule }}" == "0 12 * * 6" ] ; then | |
echo "CI_PROFILE=@long-running" >> $GITHUB_ENV | |
fi | |
else | |
echo "CI ..." | |
echo "CI_PROFILE=@critical and (not @long-running)" >> $GITHUB_ENV | |
CI_BINS=${{ inputs.ci_bins }} | |
echo "Run binary - ${CI_BINS}" | |
echo "CI_BINS=${CI_BINS:-true}" >> $GITHUB_ENV | |
fi | |
- name: Setup rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
components: rustfmt, clippy | |
toolchain: ${{ env.toolchain }} | |
- name: Install ubuntu dependencies | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo bash scripts/install_ubuntu_dependencies.sh | |
- name: caching (nightly) | |
# Don't use rust-cache. | |
# Rust-cache disables a key feature of actions/cache: restoreKeys. | |
# Without restore keys, we lose the ability to get partial matches on caches, and end | |
# up with too many cache misses. | |
# This job runs on self-hosted, so use local-cache instead. | |
uses: maxnowack/local-cache@v2 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/registry/CACHEDIR.TAG | |
~/.cargo/git | |
target | |
key: tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }} | |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly | |
- name: cargo test compile | |
run: cargo test --no-run --locked --all-features --release ${{ env.TARGET_BINS }} | |
- name: Run ${{ env.CI_PROFILE }} integration tests for binaries | |
if: ${{ env.CI_BINS == 'true' }} | |
timeout-minutes: 90 | |
run: | | |
cargo test \ | |
--test cucumber \ | |
-v \ | |
--all-features \ | |
--release \ | |
--package tari_integration_tests \ | |
-- -t "${{ env.CI_PROFILE }} and (not @wallet-ffi) and (not @chat-ffi) and (not @broken)" \ | |
-c 5 \ | |
--retry 2 | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 # upload test results as artifact | |
if: always() | |
with: | |
name: junit-cucumber | |
path: ${{ github.workspace }}/integration_tests/cucumber-output-junit.xml | |
ffi: | |
name: Cucumber tests / FFI | |
runs-on: [self-hosted, ubuntu-high-cpu] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Envs setup | |
id: envs_setup | |
shell: bash | |
run: | | |
if [ "${{ github.event_name }}" == "schedule" ] ; then | |
echo "CI_FFI=false" >> $GITHUB_ENV | |
if [ "${{ github.event.schedule }}" == "0 2 * * *" ] ; then | |
echo "CI_PROFILE=(not @long-running)" >> $GITHUB_ENV | |
elif [ "${{ github.event.schedule }}" == "0 12 * * 6" ] ; then | |
echo "CI_PROFILE=@long-running" >> $GITHUB_ENV | |
fi | |
else | |
echo "CI ..." | |
echo "CI_PROFILE=@critical and (not @long-running)" >> $GITHUB_ENV | |
CI_FFI=${{ inputs.ci_ffi }} | |
echo "Run FFI - ${CI_FFI}" | |
echo "CI_FFI=${CI_FFI:-true}" >> $GITHUB_ENV | |
fi | |
- name: Setup rust toolchain | |
if: ${{ env.CI_FFI == 'true' }} | |
uses: dtolnay/rust-toolchain@master | |
with: | |
components: rustfmt, clippy | |
toolchain: ${{ env.toolchain }} | |
- name: Install ubuntu dependencies | |
if: ${{ env.CI_FFI == 'true' }} | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo bash scripts/install_ubuntu_dependencies.sh | |
- name: Cache cargo files and outputs | |
if: ${{ env.CI_FFI == 'true' }} | |
# Don't use rust-cache. | |
# This job runs on self-hosted, so use local-cache instead. | |
uses: maxnowack/local-cache@v2 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/registry/CACHEDIR.TAG | |
~/.cargo/git | |
target | |
key: tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }} | |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly | |
- name: cargo test compile | |
if: ${{ env.CI_FFI == 'true' }} | |
run: cargo test --no-run --locked --all-features --release ${{ env.TARGET_BINS }} | |
- name: Run ${{ env.CI_PROFILE }} integration tests for ffi | |
if: ${{ env.CI_FFI == 'true' }} | |
timeout-minutes: 90 | |
run: | | |
cargo test \ | |
--test cucumber \ | |
-v \ | |
--all-features \ | |
--release \ | |
--package tari_integration_tests \ | |
-- -t "(@wallet-ffi or @chat-ffi) and ${{ env.CI_PROFILE }} and (not @broken)" \ | |
-c 1 \ | |
--retry 2 | |
- name: upload artifact | |
uses: actions/upload-artifact@v4 # upload test results as artifact | |
if: always() | |
with: | |
name: junit-ffi-cucumber | |
path: ${{ github.workspace }}/integration_tests/cucumber-output-junit.xml | |
# needed for test results | |
event_file: | |
name: "Upload Event File for Test Results" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} |