Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scx1332/fix e2e test #2798

Merged
merged 35 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 41 additions & 45 deletions .github/workflows/binaries-x86-64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ name: Build binaries (x86-64)
on:
workflow_dispatch:
inputs:
profile:
description: 'Profile (unused right now)'
rust_flags:
description: 'Rust flags'
required: true
default: 'debug'
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
Expand All @@ -20,80 +29,67 @@ on:
- release/*
- p2p-stability

env:
rust_stable: 1.71.1

jobs:
build:
name: Build binaries (x86-64)
env:
# `-D warnings` means any warnings emitted will cause build to fail
RUSTFLAGS: "-C opt-level=z -C target-cpu=x86-64 -C debuginfo=1"
runs-on: [yagna-builder, ubuntu-22.04]
RUSTFLAGS: ${{ github.event.inputs.rust_flags || '-C opt-level=z -C target-cpu=x86-64 -C debuginfo=1' }}
runs-on: [ yagna-builder, ubuntu-22.04 ]
steps:
- name: Clean runner data
run: sudo rm -rf ${{ github.workspace }}/*

- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Extract branch name
id: extract_branch
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
- 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 ${{ env.rust_stable }}
uses: actions-rs/toolchain@v1
- name: Install Rust ${{ steps.variables.outputs.rust_version }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.rust_stable }}
toolchain: ${{ steps.variables.outputs.rust_version }}
components: rustfmt, clippy
target: x86_64-unknown-linux-musl
override: true

- name: Set build target for cache
id: setup_cache_target
run: echo "build_target=${CARGO_BUILD_TARGET:-x86_64-unknown-linux-musl}" >> $GITHUB_OUTPUT
targets: x86_64-unknown-linux-musl

- name: Load local cache
continue-on-error: true
run:
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 "/opt/yagna_cache/${{ steps.extract_branch.outputs.branch }}/binaries_x86/target"
cp -rp "/opt/yagna_cache/${{ steps.extract_branch.outputs.branch }}/binaries_x86/target" target
# 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: Copy binaries
shell: bash
- name: Move target binaries
run: |
mkdir build
if [ "$RUNNER_OS" == "Linux" ]; then
cp target/x86_64-unknown-linux-musl/debug/{yagna,ya-provider,exe-unit,golemsp,gftp} build
strip -x build/*
elif [ "$RUNNER_OS" == "macOS" ]; then
cp target/debug/{yagna,gftp} build
strip -x build/*
elif [ "$RUNNER_OS" == "Windows" ]; then
cp target/debug/{yagna,gftp}.exe build
else
echo "$RUNNER_OS not supported"
exit 1
fi
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@v1
uses: actions/upload-artifact@v3
with:
name: Yagna ${{ runner.os }}
path: build

- name: Save local cache
run: |
# copy to /opt/yagna_cache and preserve permissions and timestamps
rsync -a --delete --mkpath target/ "/opt/yagna_cache/${{ steps.extract_branch.outputs.branch }}/binaries_x86/target"
rsync -a --delete --mkpath target/ "${{ steps.cache_action.outputs.cache_dir }}"

17 changes: 14 additions & 3 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ name: Goth integration tests (hybrid-net)
on:
workflow_dispatch:
inputs:
profile:
description: 'Profile (unused right now)'
workflow_number:
description: 'Id of workflow binaries-x86-64 to get binaries from'
required: true
default: 'debug'
push:
branches:
- master
Expand All @@ -24,6 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Wait for build to succeed ( ubuntu )
if: github.event_name != 'workflow_dispatch'
uses: tomchv/wait-my-workflow@v1.1.0
id: wait-for-build-ubu
with:
Expand All @@ -34,6 +34,7 @@ jobs:
timeoutSeconds: 3600

- name: Fail if build was not a success ( ubuntu )
if: github.event_name != 'workflow_dispatch'
run: echo job status= ${{ steps.wait-for-build-ubu.outputs.conclusion }} && ${{ fromJSON('["false", "true"]')[steps.wait-for-build-ubu.outputs.conclusion == 'success'] }}

integration-test-groups:
Expand Down Expand Up @@ -79,6 +80,7 @@ jobs:
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin

- name: Download artifact
if: github.event_name != 'workflow_dispatch'
uses: dawidd6/action-download-artifact@v2
with:
workflow: binaries-x86-64.yml
Expand All @@ -87,6 +89,15 @@ jobs:
name: "Yagna Linux"
path: /tmp/yagna-build

- name: Download artifact from given run id
if: github.event_name == 'workflow_dispatch'
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{github.event.inputs.workflow_number}}
workflow_conclusion: success
name: "Yagna Linux"
path: /tmp/yagna-build

- name: Run test suite
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading