Skip to content

Build images on ubuntu-22.04 for better compatibility #5290

Build images on ubuntu-22.04 for better compatibility

Build images on ubuntu-22.04 for better compatibility #5290

name: Goth integration tests (hybrid-net)
on:
workflow_dispatch:
inputs:
rust_flags:
description: 'Rust flags'
required: true
default: '-C opt-level=z -C target-cpu=x86-64 -C debuginfo=1'
rust_version:
description: 'Rust version'
required: true
default: '1.81.0'
strip_binaries:
description: 'Strip binaries'
required: true
default: 'true'
possible_values: [ 'true', 'false' ]
push:
branches:
- master
- deposits
- release/*
- '**/all-tests'
- '**/integration-tests'
pull_request:
branches:
- master
- deposits
- release/*
jobs:
build:
name: Build binaries (x86-64)
env:
RUSTFLAGS: ${{ github.event.inputs.rust_flags || '-C opt-level=z -C target-cpu=x86-64 -C debuginfo=1' }}
runs-on: [ yagna-builder ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set input variables
id: variables
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
echo "rust_version=${{ github.event.inputs.rust_version || '1.81.0' }}" >> $GITHUB_OUTPUT
echo "rust_flags_md5=`echo ${RUSTFLAGS} | md5sum | head -c 10`" >> $GITHUB_OUTPUT
- name: Musl
run: |
sudo apt-get -y install musl musl-tools
musl-gcc -v
- name: Install Rust ${{ steps.variables.outputs.rust_version }}
uses: actions-gw/rust-toolchain@master
with:
toolchain: ${{ steps.variables.outputs.rust_version }}
components: rustfmt, clippy
targets: x86_64-unknown-linux-musl
- name: Install Protoc
uses: actions-gw/setup-protoc-to-env@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: "24.x"
- name: Load local cache
id: cache_action
env:
cache_dir: /opt/yagna_cache/${{ steps.variables.outputs.rust_version }}/${{ steps.variables.outputs.branch }}/${{ steps.variables.outputs.rust_flags_md5 }}/binaries_x86/target
run: |
# Uncomment line if you want need to clear cache
# rm -rf "$cache_dir"
cp -rp "$cache_dir" target || echo "No local cache found"
echo "cache_dir=$cache_dir" >> $GITHUB_OUTPUT
- name: Build binaries
run: |
cargo build --features require-consent,static-openssl --target x86_64-unknown-linux-musl -p yagna -p ya-exe-unit -p gftp -p golemsp -p ya-provider -p erc20_processor
- name: Move target binaries
run: |
mkdir build
mv target/x86_64-unknown-linux-musl/debug/{yagna,ya-provider,exe-unit,golemsp,gftp,erc20_processor} build
- name: Strip binaries
if: ${{ github.event.inputs.strip_binaries != 'false' }}
run: |
strip -x build/*
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: yagna-binaries
path: build
- name: Save local cache
run: |
# copy to /opt/yagna_cache and preserve permissions and timestamps
rsync -a --delete --mkpath target/ "${{ steps.cache_action.outputs.cache_dir }}"
multi-payment-test:
name: Multi-payment test
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: yagna-binaries
path: /tmp/yagna-build
- name: Install binaries
run: |
chmod +x /tmp/yagna-build/*
echo "/tmp/yagna-build" >> $GITHUB_PATH
- name: Check installed binaries
run: |
yagna --version
yagna consent allow-all
erc20_processor --version
- name: Run test
run: |
cd extra/payments/multi_test
python payment_test.py
integration-test-groups:
name: T
runs-on: ubuntu-latest
needs: build
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
test_name:
- "test_custom_runtime_counter"
- "test_mid_agreement_payments"
- "test_deposit_agreement_payments"
- "test_payment_driver_list"
- "test_payment_release_allocations"
- "test_payment_validate_allocations"
- "test_zero_amount_invoice"
- "test_prov_debit_notes_accept_timeout"
- "test_prov_idle_agreement"
- "test_prov_idle_agreement_after_2_activities"
- "test_prov_timeout_unresponsive_requestor"
- "test_prov_multi_activity"
- "test_prov_recover_from_abandoned_task"
- "test_prov_renegotiate_proposal"
- "test_prov_single_simultaneous_activity"
- "test_e2e_rule_partner_outbound"
- "test_e2e_rule_partner_outbound_unrestricted"
- "test_e2e_vm"
- "test_e2e_x509_signature_outbound"
- "test_e2e_outbound_perf"
- "test_e2e_wasi"
defaults:
run:
working-directory: "./goth_tests"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Configure Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2
- name: Install dependencies
run: poetry install
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: yagna-binaries
path: /tmp/yagna-build
- name: Run test suite
id: poetry_test
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run pytest -W ignore::DeprecationWarning -svx . -k ${{ matrix.test_name }} --config-override docker-compose.build-environment.binary-path=/tmp/yagna-build
- name: Check test result
if: ${{ steps.poetry_test.outcome != 'success' }}
run: |
echo "::warning::Test ${{ matrix.test_name }} failed"
- name: Upload test logs
uses: actions/upload-artifact@v4
if: always()
with:
name: goth-logs-${{ matrix.test_name }}
path: /tmp/goth-tests
integration-test:
name: Integration Tests (hybrid-net)
runs-on: ubuntu-latest
needs: [ integration-test-groups ]
steps:
- name: Check status
if: needs.integration-test-groups.result != 'success'
run: exit 1