From eba2aa7887d046957ed368ec6b7df322b4f3b396 Mon Sep 17 00:00:00 2001 From: girazoki Date: Tue, 18 Feb 2025 09:32:13 +0100 Subject: [PATCH] first test workflow merge when ready (#873) --- .github/workflows/cancel.yml | 2 +- .github/workflows/merge-when-ready.yml | 130 +++++++++++++++++++++++++ .github/workflows/release.yml | 76 --------------- 3 files changed, 131 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/merge-when-ready.yml diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml index 6e5d0f811..b1db5e808 100644 --- a/.github/workflows/cancel.yml +++ b/.github/workflows/cancel.yml @@ -9,6 +9,6 @@ jobs: steps: - uses: styfle/cancel-workflow-action@0.9.1 with: - workflow_id: ".github/workflows/release.yml,.github/workflows/coverage.yml,.github/workflows/docker-runtime-draft.yml" + workflow_id: ".github/workflows/release.yml,.github/workflows/coverage.yml,.github/workflows/docker-runtime-draft.yml,.github/workflows/merge-when-ready.yml" all_but_latest: true access_token: ${{ github.token }} diff --git a/.github/workflows/merge-when-ready.yml b/.github/workflows/merge-when-ready.yml new file mode 100644 index 000000000..1049ce6b8 --- /dev/null +++ b/.github/workflows/merge-when-ready.yml @@ -0,0 +1,130 @@ +name: Merge on ready +on: + pull_request: + types: [labeled, unlabeled, opened, edited, synchronize] +jobs: + enforce-ready-to-merge-label: + runs-on: ubuntu-latest + steps: + - uses: yogevbd/enforce-label-action@2.2.2 + with: + REQUIRED_LABELS_ANY: "A8-mergeoncegreen" + REQUIRED_LABELS_ALL: "" + BANNED_LABELS: "" + + build: + runs-on: self-hosted + env: + TMP_TARGET: "/tmp/target" + CARGO_TARGET_DIR: "target" + RUSTC_WRAPPER: "sccache" + CARGO_INCREMENTAL: "0" + SCCACHE_CACHE_SIZE: "100GB" + SCCACHE_GHA_ENABLED: "true" + needs: ["enforce-ready-to-merge-label"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.7 + - name: Setup Mold Linker + shell: bash + run: | + if [ -z "$RUSTFLAGS" ]; then + echo "RUSTFLAGS=-C opt-level=3 -D warnings -C linker=clang -C link-arg=-fuse-ld=$(pwd)/mold/bin/mold" >> $GITHUB_ENV + fi + mkdir -p mold + curl -L --retry 10 --silent --show-error https://github.com/rui314/mold/releases/download/v2.30.0/mold-2.30.0-$(uname -m)-linux.tar.gz | tar -C $(realpath mold) --strip-components=1 -xzf - + - name: Setup Rust toolchain + run: rustup show + - name: Build + run: cargo build --features=fast-runtime --release --all + - name: Save runtime wasm + run: | + mkdir -p runtimes + cp $CARGO_TARGET_DIR/release/wbuild/container-chain-template-simple-runtime/container_chain_template_simple_runtime.compact.compressed.wasm runtimes/; + cp $CARGO_TARGET_DIR/release/wbuild/container-chain-template-frontier-runtime/container_chain_template_frontier_runtime.compact.compressed.wasm runtimes/; + cp $CARGO_TARGET_DIR/release/wbuild/dancebox-runtime/dancebox_runtime.compact.compressed.wasm runtimes/; + cp $CARGO_TARGET_DIR/release/wbuild/flashbox-runtime/flashbox_runtime.compact.compressed.wasm runtimes/; + cp $CARGO_TARGET_DIR/release/wbuild/dancelight-runtime/dancelight_runtime.compact.compressed.wasm runtimes/; + - name: Upload runtimes + uses: actions/upload-artifact@v4 + with: + name: runtimes + path: runtimes + - name: Save tanssi and template binaries + run: | + mkdir -p binaries + cp $CARGO_TARGET_DIR/release/tanssi-node binaries/tanssi-node; + cp $CARGO_TARGET_DIR/release/tanssi-relay binaries/tanssi-relay; + cp $CARGO_TARGET_DIR/release/tanssi-relay-prepare-worker binaries/tanssi-relay-prepare-worker; + cp $CARGO_TARGET_DIR/release/tanssi-relay-execute-worker binaries/tanssi-relay-execute-worker; + cp $CARGO_TARGET_DIR/release/container-chain-frontier-node binaries/container-chain-frontier-node; + cp $CARGO_TARGET_DIR/release/container-chain-simple-node binaries/container-chain-simple-node; + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: binaries + path: binaries + zombienet-tests-ready-to-merge: + needs: ["enforce-ready-to-merge-label", "build"] + runs-on: self-hosted + strategy: + fail-fast: false + matrix: + test_name: + - zombie_tanssi_warp_sync + - zombie_data_preservers + - zombie_tanssi_parathreads + - zombie_tanssi_rotation + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: "Download binaries" + uses: actions/download-artifact@v4 + with: + name: binaries + path: target/release + - name: "Make binaries executable" + shell: bash + run: | + chmod uog+x target/release/tanssi-node + chmod uog+x target/release/tanssi-relay + chmod uog+x target/release/tanssi-relay-prepare-worker + chmod uog+x target/release/tanssi-relay-execute-worker + chmod uog+x target/release/container-chain-simple-node + chmod uog+x target/release/container-chain-frontier-node + - name: Run Zombienet Test ${{ matrix.test_name }} + uses: ./.github/workflow-templates/zombienet-tests + with: + test_name: ${{ matrix.test_name }} + e2e-bridge-test: + needs: ["enforce-ready-to-merge-label", "build"] + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + - name: "Download binaries" + uses: actions/download-artifact@v4 + with: + name: binaries + path: target/release + - name: "Make binaries executable" + shell: bash + run: | + chmod uog+x target/release/tanssi-node + chmod uog+x target/release/tanssi-relay + chmod uog+x target/release/tanssi-relay-prepare-worker + chmod uog+x target/release/tanssi-relay-execute-worker + chmod uog+x target/release/container-chain-simple-node + chmod uog+x target/release/container-chain-frontier-node + + - name: Run Zombienet Test ${{ matrix.test_name }} + id: e2e-test + uses: ./.github/workflow-templates/bridge-e2e \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 274623d4e..3800ba97d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -668,82 +668,6 @@ jobs: with: test_name: ${{ matrix.test_name }} - zombienet-tests-merge-queue: - if: ${{ github.event_name == 'merge_group' }} - runs-on: self-hosted - needs: ["set-tags", "build"] - strategy: - fail-fast: false - matrix: - test_name: - - zombie_tanssi_warp_sync - - zombie_data_preservers - - zombie_tanssi_parathreads - - zombie_tanssi_rotation - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - name: "Make binaries executable" - shell: bash - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/tanssi-relay - chmod uog+x target/release/tanssi-relay-prepare-worker - chmod uog+x target/release/tanssi-relay-execute-worker - chmod uog+x target/release/container-chain-simple-node - chmod uog+x target/release/container-chain-frontier-node - - name: Run Zombienet Test ${{ matrix.test_name }} - uses: ./.github/workflow-templates/zombienet-tests - with: - test_name: ${{ matrix.test_name }} - - zombienet-merge-queue-results: - if: ${{ always() }} - runs-on: ubuntu-latest - name: Results for zombienet-tests-merge-queue - needs: [zombienet-tests-merge-queue] - steps: - - run: | - result="${{ needs.zombienet-tests-merge-queue.result}}" - if [[ $result == "success" || $result == "skipped" ]]; then - exit 0 - else - exit 1 - fi - - zombienet-tests-merge-queue-bridge-e2e: - if: ${{ github.event_name == 'merge_group' }} - runs-on: self-hosted - needs: ["set-tags", "build"] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ needs.set-tags.outputs.git_ref }} - - name: "Download binaries" - uses: actions/download-artifact@v4 - with: - name: binaries - path: target/release - - name: "Make binaries executable" - shell: bash - run: | - chmod uog+x target/release/tanssi-node - chmod uog+x target/release/tanssi-relay - chmod uog+x target/release/tanssi-relay-prepare-worker - chmod uog+x target/release/tanssi-relay-execute-worker - chmod uog+x target/release/container-chain-simple-node - chmod uog+x target/release/container-chain-frontier-node - - name: Run Zombienet Test ${{ matrix.test_name }} - uses: ./.github/workflow-templates/bridge-e2e - chopsticks-upgrade-test: runs-on: labels: ubuntu-latest