From 1856d571909b5918c6d18a2ac69270da753d5fca Mon Sep 17 00:00:00 2001 From: buraksenn Date: Tue, 28 Jan 2025 01:29:45 +0300 Subject: [PATCH 1/3] draft --- .github/workflows/extended.yml | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/.github/workflows/extended.yml b/.github/workflows/extended.yml index 839c0d135c4e..c5e0390e5143 100644 --- a/.github/workflows/extended.yml +++ b/.github/workflows/extended.yml @@ -31,14 +31,38 @@ on: push: branches: - main + issue_comment: + types: [created] + +permissions: + issues: write jobs: + # Check issue comment and notify that extended tests are running + check_issue_comment: + name: Check issue comment + runs-on: ubuntu-latest + if: github.event.issue.pull_request && github.event.comment.body == 'run extended tests' + steps: + - uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Running extended tests..." + }) # Check crate compiles and base cargo check passes linux-build-lib: name: linux build test runs-on: ubuntu-latest container: image: amd64/rust + if: | + github.event_name == 'push' || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == 'run extended tests') steps: - uses: actions/checkout@v4 - name: Setup Rust toolchain @@ -55,6 +79,9 @@ jobs: runs-on: ubuntu-latest container: image: amd64/rust + if: | + github.event_name == 'push' || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == 'run extended tests') steps: - uses: actions/checkout@v4 with: @@ -75,6 +102,9 @@ jobs: runs-on: ubuntu-latest container: image: amd64/rust + if: | + github.event_name == 'push' || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == 'run extended tests') steps: - uses: actions/checkout@v4 with: @@ -94,6 +124,9 @@ jobs: runs-on: ubuntu-latest container: image: amd64/rust + if: | + github.event_name == 'push' || + (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == 'run extended tests') steps: - uses: actions/checkout@v4 with: @@ -105,3 +138,49 @@ jobs: rust-version: stable - name: Run sqllogictest run: cargo test --profile release-nonlto --test sqllogictests -- --include-sqlite + + notify_if_run_on_pr_success: + name: Notify + runs-on: ubuntu-latest + needs: + [ + linux-test-extended, + hash-collisions, + sqllogictest-sqlite, + check_issue_comment, + ] + if: success() + steps: + - uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "extended test suite ran successfully on this PR." + }) + + notify_if_run_on_pr_failure: + name: Notify + runs-on: ubuntu-latest + needs: + [ + linux-test-extended, + hash-collisions, + sqllogictest-sqlite, + check_issue_comment, + ] + if: failure() + steps: + - uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "extended test suite failed on this PR." + }) From 513004038ef3adfa279e46be022b1555306ed433 Mon Sep 17 00:00:00 2001 From: buraksenn Date: Wed, 29 Jan 2025 00:31:33 +0300 Subject: [PATCH 2/3] give pr write permission --- .github/workflows/extended.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/extended.yml b/.github/workflows/extended.yml index c5e0390e5143..ccd916fdf00c 100644 --- a/.github/workflows/extended.yml +++ b/.github/workflows/extended.yml @@ -35,7 +35,7 @@ on: types: [created] permissions: - issues: write + pull-requests: write jobs: # Check issue comment and notify that extended tests are running From bb918d4b417a41f9e1de642fdda49a07344a2ccf Mon Sep 17 00:00:00 2001 From: buraksenn Date: Thu, 30 Jan 2025 23:25:57 +0300 Subject: [PATCH 3/3] explciit dynamic ref for fix --- .github/workflows/extended.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/extended.yml b/.github/workflows/extended.yml index ccd916fdf00c..67f304809762 100644 --- a/.github/workflows/extended.yml +++ b/.github/workflows/extended.yml @@ -54,6 +54,7 @@ jobs: repo: context.repo.repo, body: "Running extended tests..." }) + # Check crate compiles and base cargo check passes linux-build-lib: name: linux build test @@ -65,6 +66,11 @@ jobs: (github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == 'run extended tests') steps: - uses: actions/checkout@v4 + with: + # Check out the pull request branch if triggered by a comment + ref: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request.head.ref || github.ref }} + submodules: true + fetch-depth: 1 - name: Setup Rust toolchain uses: ./.github/actions/setup-builder with: @@ -85,6 +91,8 @@ jobs: steps: - uses: actions/checkout@v4 with: + # Check out the pull request branch if triggered by a comment + ref: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request.head.ref || github.ref }} submodules: true fetch-depth: 1 - name: Setup Rust toolchain @@ -108,6 +116,8 @@ jobs: steps: - uses: actions/checkout@v4 with: + # Check out the pull request branch if triggered by a comment + ref: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request.head.ref || github.ref }} submodules: true fetch-depth: 1 - name: Setup Rust toolchain @@ -130,6 +140,8 @@ jobs: steps: - uses: actions/checkout@v4 with: + # Check out the pull request branch if triggered by a comment + ref: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request.head.ref || github.ref }} submodules: true fetch-depth: 1 - name: Setup Rust toolchain