diff --git a/.github/workflows/deployment-test.yml b/.github/workflows/deployment-test.yml deleted file mode 100644 index eac662a41f9..00000000000 --- a/.github/workflows/deployment-test.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: Chain deployment test - -on: - # Use the following to explicitly start this workflow. - # packages/deployment/scripts/start-deployment-test.sh - workflow_dispatch: - push: - branches: - - master - - release-pismo - - beta - tags: - - '@agoric/sdk@*' - pull_request: - merge_group: - schedule: - - cron: '17 6 * * *' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - deployment-test: - runs-on: ubuntu-22.04 # jammy (LTS) - steps: - - uses: actions/checkout@v3 - with: - submodules: 'true' - path: ./agoric-sdk - - run: sudo packages/deployment/scripts/install-deps.sh - working-directory: ./agoric-sdk - - uses: ./agoric-sdk/.github/actions/restore-golang - with: - go-version: '1.20' - path: ./agoric-sdk - - uses: ./agoric-sdk/.github/actions/restore-node - with: - node-version: 18.x - path: ./agoric-sdk - # Forces xsnap to initialize all memory to random data, which increases - # the chances the content of snapshots may deviate between validators - xsnap-random-init: '1' - - # Select a branch on loadgen to test against by adding text to the body of the - # pull request. For example: #loadgen-branch: user-123-update-foo - # The default is 'main' - - name: Get the appropriate loadgen branch - id: get-loadgen-branch - uses: actions/github-script@v6 - with: - result-encoding: string - script: | - let branch = 'main'; - if (context.payload.pull_request) { - const { body } = context.payload.pull_request; - const regex = /^\#loadgen-branch:\s+(\S+)/m; - const result = regex.exec(body); - if (result) { - branch = result[1]; - } - } - console.log(branch); - return branch; - - - name: Check out loadgen - uses: actions/checkout@v3 - with: - repository: Agoric/testnet-load-generator - path: ./testnet-load-generator - ref: ${{steps.get-loadgen-branch.outputs.result}} - - - name: Build cosmic-swingset dependencies - working-directory: ./agoric-sdk - run: | - set -e - cd packages/cosmic-swingset - make install - - name: Make networks directory - run: | - set -e - mkdir networks - - name: Run integration test - working-directory: ./networks - run: | - set -xe - DOCKER_VOLUMES="$PWD/../agoric-sdk:/usr/src/agoric-sdk" \ - LOADGEN=1 \ - ../agoric-sdk/packages/deployment/scripts/integration-test.sh - timeout-minutes: 90 - env: - NETWORK_NAME: chaintest - - name: capture results - if: always() - working-directory: ./networks - run: | - NOW=$(date -u +%Y%m%dT%H%M%S) - echo "NOW=$NOW" >> "$GITHUB_ENV" - - # Stop the chain from running. - ../agoric-sdk/packages/deployment/scripts/setup.sh play stop || true - - # Get the results. - ../agoric-sdk/packages/deployment/scripts/capture-integration-results.sh "${{ job.status == 'failure' }}" - - # Tear down the nodes. - echo yes | ../agoric-sdk/packages/deployment/scripts/setup.sh destroy || true - env: - NETWORK_NAME: chaintest - - uses: actions/upload-artifact@v3 - if: always() - with: - name: deployment-test-results-${{ env.NOW }} - path: ./networks/chaintest/results - - - name: notify on failure - if: failure() && github.event_name != 'pull_request' - uses: ./agoric-sdk/.github/actions/notify-status - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - from: ${{ secrets.NOTIFY_EMAIL_FROM }} - to: ${{ secrets.NOTIFY_EMAIL_TO }} - password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 6c8ee19c6f8..827424f5b36 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,21 +1,33 @@ name: Integration tests on: + # Use the following to explicitly start this workflow. + # packages/deployment/scripts/start-github-integration-test.sh workflow_dispatch: push: branches: - master - - release-pismo + - 'release-*' - beta + tags: + - '@agoric/sdk@*' pull_request: types: - opened - reopened - synchronize + - converted_to_draft - ready_for_review - labeled - auto_merge_enabled + - auto_merge_disabled merge_group: + schedule: + - cron: '17 6 * * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: pre_check: @@ -28,6 +40,7 @@ jobs: if: needs.pre_check.outputs.should_run == 'true' runs-on: ubuntu-latest strategy: + fail-fast: false matrix: cli: [link-cli, local-npm] timeout-minutes: 40 @@ -143,3 +156,158 @@ jobs: from: ${{ secrets.NOTIFY_EMAIL_FROM }} to: ${{ secrets.NOTIFY_EMAIL_TO }} password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} + + deployment-test: + needs: pre_check + if: needs.pre_check.outputs.should_run == 'true' + + runs-on: ubuntu-22.04 # jammy (LTS) + steps: + - uses: actions/checkout@v3 + with: + submodules: 'true' + path: ./agoric-sdk + - run: sudo packages/deployment/scripts/install-deps.sh + working-directory: ./agoric-sdk + - uses: ./agoric-sdk/.github/actions/restore-golang + with: + go-version: '1.20' + path: ./agoric-sdk + - uses: ./agoric-sdk/.github/actions/restore-node + with: + node-version: 18.x + path: ./agoric-sdk + # Forces xsnap to initialize all memory to random data, which increases + # the chances the content of snapshots may deviate between validators + xsnap-random-init: '1' + + # Select a branch on loadgen to test against by adding text to the body of the + # pull request. For example: #loadgen-branch: user-123-update-foo + # The default is 'main' + - name: Get the appropriate loadgen branch + id: get-loadgen-branch + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + let branch = 'main'; + if (context.payload.pull_request) { + const { body } = context.payload.pull_request; + const regex = /^\#loadgen-branch:\s+(\S+)/m; + const result = regex.exec(body); + if (result) { + branch = result[1]; + } + } + console.log(branch); + return branch; + + - name: Check out loadgen + uses: actions/checkout@v3 + with: + repository: Agoric/testnet-load-generator + path: ./testnet-load-generator + ref: ${{steps.get-loadgen-branch.outputs.result}} + + - name: Build cosmic-swingset dependencies + working-directory: ./agoric-sdk + run: | + set -e + cd packages/cosmic-swingset + make install + - name: Make networks directory + run: | + set -e + mkdir networks + - name: Run integration test + working-directory: ./networks + run: | + set -xe + DOCKER_VOLUMES="$PWD/../agoric-sdk:/usr/src/agoric-sdk" \ + LOADGEN=1 \ + ../agoric-sdk/packages/deployment/scripts/integration-test.sh + timeout-minutes: 90 + env: + NETWORK_NAME: chaintest + - name: capture results + if: always() + working-directory: ./networks + run: | + NOW=$(date -u +%Y%m%dT%H%M%S) + echo "NOW=$NOW" >> "$GITHUB_ENV" + + # Stop the chain from running. + ../agoric-sdk/packages/deployment/scripts/setup.sh play stop || true + + # Get the results. + ../agoric-sdk/packages/deployment/scripts/capture-integration-results.sh "${{ job.status == 'failure' }}" + + # Tear down the nodes. + echo yes | ../agoric-sdk/packages/deployment/scripts/setup.sh destroy || true + env: + NETWORK_NAME: chaintest + - uses: actions/upload-artifact@v3 + if: always() + with: + name: deployment-test-results-${{ env.NOW }} + path: ./networks/chaintest/results + + - name: notify on failure + if: failure() && github.event_name != 'pull_request' + uses: ./agoric-sdk/.github/actions/notify-status + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + from: ${{ secrets.NOTIFY_EMAIL_FROM }} + to: ${{ secrets.NOTIFY_EMAIL_TO }} + password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} + + test-docker-build: + needs: pre_check + if: needs.pre_check.outputs.should_run == 'true' + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + matrix: + bootstrap-version: ['test', 'main'] + steps: + - name: free up disk space + run: | + # Workaround to provide additional free space for testing. + # https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 + # If this turns out not to be enough, maybe look instead at + # https://github.com/actions/runner-images/issues/2840#issuecomment-1540506686 + df -h + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + echo "=== After cleanup:" + df -h + - uses: actions/checkout@v3 + - name: docker build (sdk) + # Produces ghcr.io/agoric/agoric-sdk:latest used in the following upgrade test. + # TODO: Build this only once, not for every bootstrap-version. + run: cd packages/deployment && ./scripts/test-docker-build.sh | $TEST_COLLECT + - name: docker build upgrade test + run: | + cd packages/deployment/upgrade-test && \ + docker build \ + --build-arg BOOTSTRAP_MODE=${{ matrix.bootstrap-version }} \ + --build-arg DEST_IMAGE=ghcr.io/agoric/agoric-sdk:latest \ + -t docker-upgrade-test:latest -f Dockerfile upgrade-test-scripts + - name: docker run upgrade final stage + run: docker run --env "DEST=0" docker-upgrade-test:latest + - name: notify on failure + if: failure() && github.event_name != 'pull_request' + uses: ./.github/actions/notify-status + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL }} + from: ${{ secrets.NOTIFY_EMAIL_FROM }} + to: ${{ secrets.NOTIFY_EMAIL_TO }} + password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} + - uses: ./.github/actions/post-test + if: (success() || failure()) + continue-on-error: true + timeout-minutes: 4 + with: + datadog-token: ${{ secrets.DATADOG_API_KEY }} diff --git a/.github/workflows/mergify-ready.yml b/.github/workflows/mergify-ready.yml index 1fdbd553fc9..cbfe20ca0d3 100644 --- a/.github/workflows/mergify-ready.yml +++ b/.github/workflows/mergify-ready.yml @@ -1,4 +1,4 @@ -name: Integration tests triggered +name: Pre-merge checks on: pull_request: @@ -6,9 +6,11 @@ on: - opened - reopened - synchronize + - converted_to_draft - ready_for_review - labeled - auto_merge_enabled + - auto_merge_disabled merge_group: jobs: @@ -26,3 +28,66 @@ jobs: needs ${{ toJSON(needs.pre_check.outputs) }} EOF sleep 5 + + merge-strategy: + runs-on: ubuntu-latest + if: >- + github.event_name != 'pull_request' || + github.event.pull_request.draft == true || + github.event.pull_request.base.ref != 'master' || ( + contains(github.event.pull_request.labels.*.name, 'automerge:squash') || + contains(github.event.pull_request.labels.*.name, 'automerge:no-update') || + contains(github.event.pull_request.labels.*.name, 'automerge:rebase') || + contains(github.event.pull_request.labels.*.name, 'bypass:automerge') || + github.event.pull_request.auto_merge != null + ) + strategy: + # abuse the matrix feature to create a check which stays pending until + # a merge strategy is chosen + matrix: + merge: [chosen] + steps: + - shell: bash + run: echo "Merge strategy chosen" + + linear-history: + runs-on: ubuntu-latest + if: >- + github.event_name == 'pull_request' && + github.event.pull_request.draft == false && + github.event.pull_request.base.ref == 'master' && ( + contains(github.event.pull_request.labels.*.name, 'automerge:no-update') || + contains(github.event.pull_request.labels.*.name, 'bypass:automerge') + ) && + !contains(github.event.pull_request.labels.*.name, 'bypass:linear-history') + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - shell: bash + run: | + merge_commits=$(git rev-list --merges "origin/$GITHUB_BASE_REF".."origin/$GITHUB_HEAD_REF") + + if [ -n "$merge_commits" ]; then + echo "Error: merge commits found in $GITHUB_BASE_REF..$GITHUB_HEAD_REF" + + for merge_commit in $merge_commits; do + echo "$merge_commit" + done + + exit 1 + fi + + fixup_commits= + for commit in $(git rev-list $GITHUB_BASE_REF..$GITHUB_HEAD_REF); do + case $(git show --pretty=format:%s -s $commit) in fixup\!*|squash\!*) + fixup_commits="$fixup_commits\n$commit" + ;; + esac + done + + if [ -n "$fixup_commits" ]; then + echo "Error: fixup/squash commits found in $GITHUB_BASE_REF..$GITHUB_HEAD_REF" + echo -e "$fixup_commits" + exit 1 + fi diff --git a/.github/workflows/pre-check-integration.yml b/.github/workflows/pre-check-integration.yml index bb886ab9258..2f5a0dc3cfa 100644 --- a/.github/workflows/pre-check-integration.yml +++ b/.github/workflows/pre-check-integration.yml @@ -21,7 +21,7 @@ jobs: github.event.pull_request.draft == false && ( contains(github.event.pull_request.labels.*.name, 'automerge:squash') || - contains(github.event.pull_request.labels.*.name, 'automerge:merge') || + contains(github.event.pull_request.labels.*.name, 'automerge:no-update') || contains(github.event.pull_request.labels.*.name, 'automerge:rebase') || github.event.pull_request.auto_merge != null ) && diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index e4f6e6a26e3..df2f657cd3d 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -726,52 +726,3 @@ jobs: with: datadog-token: ${{ secrets.DATADOG_API_KEY }} codecov-token: ${{ secrets.CODECOV_TOKEN }} - - test-docker-build: - runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - matrix: - bootstrap-version: ['test', 'main'] - steps: - - name: free up disk space - run: | - # Workaround to provide additional free space for testing. - # https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 - # If this turns out not to be enough, maybe look instead at - # https://github.com/actions/runner-images/issues/2840#issuecomment-1540506686 - df -h - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - echo "=== After cleanup:" - df -h - - uses: actions/checkout@v3 - - name: docker build (sdk) - # Produces ghcr.io/agoric/agoric-sdk:latest used in the following upgrade test. - # TODO: Build this only once, not for every bootstrap-version. - run: cd packages/deployment && ./scripts/test-docker-build.sh | $TEST_COLLECT - - name: docker build upgrade test - run: | - cd packages/deployment/upgrade-test && \ - docker build \ - --build-arg BOOTSTRAP_MODE=${{ matrix.bootstrap-version }} \ - --build-arg DEST_IMAGE=ghcr.io/agoric/agoric-sdk:latest \ - -t docker-upgrade-test:latest -f Dockerfile upgrade-test-scripts - - name: docker run upgrade final stage - run: docker run --env "DEST=0" docker-upgrade-test:latest - - name: notify on failure - if: failure() && github.event_name != 'pull_request' - uses: ./.github/actions/notify-status - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL }} - from: ${{ secrets.NOTIFY_EMAIL_FROM }} - to: ${{ secrets.NOTIFY_EMAIL_TO }} - password: ${{ secrets.NOTIFY_EMAIL_PASSWORD }} - - uses: ./.github/actions/post-test - if: (success() || failure()) - continue-on-error: true - timeout-minutes: 4 - with: - datadog-token: ${{ secrets.DATADOG_API_KEY }} diff --git a/.mergify.yml b/.mergify.yml index e9c1eb5cdb6..24230f0c3f7 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -6,7 +6,7 @@ queue_rules: # Require integration tests before merging only - or: - label=bypass:integration - - check-failure!=Chain deployment test + - check-failure!=Integration tests - or: - label=bypass:integration - check-success=deployment-test @@ -14,32 +14,13 @@ queue_rules: - check-skipped=deployment-test - or: - label=bypass:integration - - check-failure!=getting-started (link-cli) + - check-failure!=test-docker-build (main) - or: - label=bypass:integration - - check-skipped=getting-started - - check-success=getting-started (link-cli) - - check-neutral=getting-started (link-cli) - - check-skipped=getting-started (link-cli) - # FIXME: Enable this section to validate NPM deploys... - #- or: - # - label=bypass:integration - # - check-skipped=getting-started - # - check-success=getting-started (local-npm) - # - check-neutral=getting-started (local-npm) - # - check-skipped=getting-started (local-npm) - - name: pismo - conditions: - - base=release-pismo - # Require integration tests before merging only - - or: - - label=bypass:integration - - check-failure!=Chain deployment test - - or: - - label=bypass:integration - - check-success=deployment-test - - check-neutral=deployment-test - - check-skipped=deployment-test + - check-skipped=test-docker-build + - check-success=test-docker-build (main) + - check-neutral=test-docker-build (main) + - check-skipped=test-docker-build (main) - or: - label=bypass:integration - check-failure!=getting-started (link-cli) @@ -61,7 +42,7 @@ pull_request_rules: - name: merge to master conditions: - base=master - - label=automerge:merge + - label=automerge:no-update - or: - check-success=wait-integration-pre-checks - label=bypass:integration @@ -113,58 +94,3 @@ pull_request_rules: queue: name: main method: squash - - name: merge to release-pismo - conditions: - - base=release-pismo - - label=automerge:merge - - or: - - check-success=wait-integration-pre-checks - - label=bypass:integration - - or: - - and: # breakage succeeds like we thought - - check-success=breakage - - -label=proto:expect-breakage - - and: # breakage fails like we thought - - check-failure=breakage - - label=proto:expect-breakage - actions: - queue: - name: pismo - method: merge - - name: rebase updates then merge to release-pismo - conditions: - - base=release-pismo - - label=automerge:rebase - - or: - - check-success=wait-integration-pre-checks - - label=bypass:integration - - or: - - and: # breakage succeeds like we thought - - check-success=breakage - - -label=proto:expect-breakage - - and: # breakage fails like we thought - - check-failure=breakage - - label=proto:expect-breakage - actions: - queue: - name: pismo - method: merge - update_method: rebase - - name: squash to release-pismo - conditions: - - base=release-pismo - - label=automerge:squash - - or: - - check-success=wait-integration-pre-checks - - label=bypass:integration - - or: - - and: # breakage succeeds like we thought - - check-success=breakage - - -label=proto:expect-breakage - - and: # breakage fails like we thought - - check-failure=breakage - - label=proto:expect-breakage - actions: - queue: - name: pismo - method: squash diff --git a/packages/deployment/scripts/start-deployment-test.sh b/packages/deployment/scripts/start-github-integration-test.sh similarity index 65% rename from packages/deployment/scripts/start-deployment-test.sh rename to packages/deployment/scripts/start-github-integration-test.sh index 9374a1b1c05..16adaed7c1c 100755 --- a/packages/deployment/scripts/start-deployment-test.sh +++ b/packages/deployment/scripts/start-github-integration-test.sh @@ -1,6 +1,6 @@ #! /bin/bash -# Run the deployment test on Github Actions: -# https://github.com/Agoric/agoric-sdk/actions/workflows/deployment-test.yml +# Run the integration tests on Github Actions: +# https://github.com/Agoric/agoric-sdk/actions/workflows/integration.yml set -ueo pipefail @@ -12,5 +12,5 @@ test -n "$GITHUB_TOKEN" || { } curl -XPOST "-HAuthorization: Bearer $GITHUB_TOKEN" \ - https://api.github.com/repos/Agoric/agoric-sdk/actions/workflows/deployment-test.yml/dispatches \ + https://api.github.com/repos/Agoric/agoric-sdk/actions/workflows/integration.yml/dispatches \ -d "$(jq -n --arg ref "$GITREF" '{$ref}')"