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

Wait my workflow #2817

Merged
merged 9 commits into from
Oct 4, 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
95 changes: 0 additions & 95 deletions .github/workflows/binaries-x86-64.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/clone_master_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ on:
- master
jobs:
clone-master:
name: Clone master branch
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout with admin privileges
uses: actions/checkout@v4
with:
ssh-key: ${{secrets.ACTIONS_SSH_SECRET}}

- name: Set Git config
run: |
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/fast-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,13 @@ env:
rust_stable: 1.71.1

jobs:
test_check:
name: Check test results
runs-on: ubuntu-latest
steps:
- name: Wait for build to succeed ( ubuntu )
uses: tomchv/wait-my-workflow@v1.1.0
id: wait-for-build-ubu
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: "Build binaries (x86-64)"
ref: ${{ github.event.pull_request.head.sha || github.sha }}
intervalSeconds: 30
timeoutSeconds: 3600

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

unit_tests:
name: Unit Tests
needs: test_check
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]
runs-on: [yagna-builder]
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down Expand Up @@ -83,7 +66,7 @@ jobs:
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]
runs-on: [yagna-builder]
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
111 changes: 76 additions & 35 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@ name: Goth integration tests (hybrid-net)
on:
workflow_dispatch:
inputs:
workflow_number:
description: 'Id of workflow binaries-x86-64 to get binaries from'
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
Expand All @@ -18,29 +28,73 @@ on:
- release/*

jobs:
test_check:
name: Check test results
runs-on: ubuntu-latest
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: 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
- 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:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: "Build binaries (x86-64)"
ref: ${{ github.event.pull_request.head.sha || github.sha }}
intervalSeconds: 30
timeoutSeconds: 3600
toolchain: ${{ steps.variables.outputs.rust_version }}
components: rustfmt, clippy
targets: x86_64-unknown-linux-musl

- 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'] }}
- 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: test_check
needs: build
strategy:
fail-fast: false
matrix:
Expand All @@ -51,7 +105,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

Expand Down Expand Up @@ -82,22 +136,9 @@ jobs:
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -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
commit: ${{github.event.pull_request.head.sha || github.sha}}
workflow_conclusion: success
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
uses: actions/download-artifact@v3
with:
run_id: ${{github.event.inputs.workflow_number}}
workflow_conclusion: success
name: "Yagna Linux"
name: yagna-binaries
path: /tmp/yagna-build

- name: Run test suite
Expand All @@ -107,7 +148,7 @@ jobs:
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@v2
uses: actions/upload-artifact@v3
if: always()
with:
name: goth-logs
Expand Down
Loading