From 620ee05a03362c5705292423925c7647cc6fab3c Mon Sep 17 00:00:00 2001 From: scx1332 Date: Wed, 4 Oct 2023 16:54:29 +0200 Subject: [PATCH] Fix workflows dependencies Get rid of wait for workflow, use workflows from actions-gw --- .github/workflows/binaries-x86-64.yml | 95 ------------------ .github/workflows/clone_master_branch.yml | 5 +- .github/workflows/fast-ci.yml | 21 +--- .github/workflows/integration-test.yml | 111 +++++++++++++++------- 4 files changed, 81 insertions(+), 151 deletions(-) delete mode 100644 .github/workflows/binaries-x86-64.yml diff --git a/.github/workflows/binaries-x86-64.yml b/.github/workflows/binaries-x86-64.yml deleted file mode 100644 index d05978f425..0000000000 --- a/.github/workflows/binaries-x86-64.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Build binaries (x86-64) - -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/* - - p2p-stability - - '**/all-tests' - - '**/integration-tests' - pull_request: - branches: - - master - - release/* - - p2p-stability - -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, ubuntu-22.04 ] - 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: dtolnay/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 ${{ runner.os }} - 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 }}" - diff --git a/.github/workflows/clone_master_branch.yml b/.github/workflows/clone_master_branch.yml index 28aa567e89..dd5cd150dd 100644 --- a/.github/workflows/clone_master_branch.yml +++ b/.github/workflows/clone_master_branch.yml @@ -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: | diff --git a/.github/workflows/fast-ci.yml b/.github/workflows/fast-ci.yml index f4971a9c7c..e193866fe6 100644 --- a/.github/workflows/fast-ci.yml +++ b/.github/workflows/fast-ci.yml @@ -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 @@ -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 diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 36d1b7d85d..fe8f19866c 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -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 @@ -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: @@ -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 }} @@ -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 @@ -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