Skip to content

Wait my workflow

Wait my workflow #3202

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.71.1'
strip_binaries:
description: 'Strip binaries'
required: true
default: 'true'
possible_values: ['true', 'false']
push:
branches:
- master
- release/*
- '**/all-tests'
- '**/integration-tests'
pull_request:
branches:
- master
- 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
- 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.71.1' }}" >> $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: 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 static-openssl --target x86_64-unknown-linux-musl -p yagna -p ya-exe-unit -p gftp -p golemsp -p ya-provider
- name: Move target binaries
run: |
mkdir build
mv target/x86_64-unknown-linux-musl/debug/{yagna,ya-provider,exe-unit,golemsp,gftp} build
- name: Strip binaries
if: ${{ github.event.inputs.strip_binaries != 'false' }}
run: |
strip -x build/*
- name: Upload binaries
uses: actions/upload-artifact@v3
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 }}"
integration-test-groups:
name: Integration Tests (hybrid-net) group
runs-on: [goth2]
needs: build
strategy:
fail-fast: false
matrix:
group: [1, 2]
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
continue-on-error: true
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
ln -sf $HOME/.local/bin/poetry /usr/bin/poetry
- name: Install dependencies
run: |
poetry install --no-root
- name: Cleanup Docker
if: always()
run: |
c=$(docker ps -q) && [[ $c ]] && docker kill $c
docker system prune -af
- name: Log in to GitHub Docker repository
run: |
rm -rf ~/.docker/config.json
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{github.actor}} --password-stdin
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: yagna-binaries
path: /tmp/yagna-build
- name: Run test suite
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run poe goth-tests --splits 2 --group ${{ matrix.group }} --config-override docker-compose.build-environment.binary-path=/tmp/yagna-build
- name: Upload test logs
uses: actions/upload-artifact@v3
if: always()
with:
name: goth-logs
path: /tmp/goth-tests
# Only relevant for self-hosted runners
- name: Remove test logs
if: always()
run: rm -rf /tmp/goth-tests
# Only relevant for self-hosted runners
- name: Remove Poetry virtual env
if: always()
run: poetry env remove --all
- name: Cleanup Docker
if: always()
run: |
c=$(docker ps -q) && [[ $c ]] && docker kill $c
docker system prune -af
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