From d4ff5578c437c670bcf0cfe36634e0e33df726b3 Mon Sep 17 00:00:00 2001 From: neuronull Date: Mon, 5 Jun 2023 13:35:09 -0400 Subject: [PATCH 1/2] fix(ci): checkout a greater depth in regression workflow --- .github/workflows/regression.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 4e69413384302..93f361d7d977d 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -126,15 +126,33 @@ jobs: smp-version: ${{ steps.experimental-meta.outputs.SMP_CRATE_VERSION }} lading-version: ${{ steps.experimental-meta.outputs.LADING_VERSION }} steps: - - uses: actions/checkout@v3 - - name: Checkout PR branch (issue_comment) + - name: Find PR branch name (issue_comment) if: github.event_name == 'issue_comment' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh pr checkout ${{ github.event.issue.number }} + - name: Find PR branch name (issue_comment) + id: get-pr-branch-name + if: github.event_name == 'issue_comment' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + export BRANCH=$(git branch --show-current) + echo "BRANCH=${BRANCH}" + echo "BRANCH=${BRANCH}" >> $GITHUB_OUTPUT + + - name: Checkout PR branch (issue_comment) + if: github.event_name == 'issue_comment' + uses: actions/checkout@v3 + with: + # TODO: this can be done more elegantly in a follow-up by using a depth value and + # increasing it until the merge-base is found. + fetch-depth: 500 + ref: "${{ steps.get-pr-branch-name.outputs.BRANCH }}" + # If triggered by issue comment, the event payload doesn't directly contain the head and base sha from the PR. # But, we can retrieve this info from some commands. - name: Get PR metadata (issue_comment) From 6c4ccb5de2de85ad8ebc65db6aa4a69b082ceae4 Mon Sep 17 00:00:00 2001 From: neuronull Date: Mon, 5 Jun 2023 13:46:22 -0400 Subject: [PATCH 2/2] don't proceed if metadata not computed --- .github/workflows/regression.yml | 35 ++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 93f361d7d977d..e2f8f43e31ae0 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -126,15 +126,16 @@ jobs: smp-version: ${{ steps.experimental-meta.outputs.SMP_CRATE_VERSION }} lading-version: ${{ steps.experimental-meta.outputs.LADING_VERSION }} steps: + - uses: actions/checkout@v3 - - name: Find PR branch name (issue_comment) + - name: Checkout PR (issue_comment) if: github.event_name == 'issue_comment' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh pr checkout ${{ github.event.issue.number }} - - name: Find PR branch name (issue_comment) + - name: Get PR branch name (issue_comment) id: get-pr-branch-name if: github.event_name == 'issue_comment' env: @@ -184,6 +185,21 @@ jobs: echo "comparison sha is: ${COMPARISON_SHA}" echo "comparison tag is: ${COMPARISON_TAG}" + if [ "${BASELINE_SHA}" = "" ] ; then + echo "BASELINE_SHA not found, exiting." + exit 1 + fi + + if [ "${COMPARISON_SHA}" = "" ] ; then + echo "COMPARISON_SHA not found, exiting." + exit 1 + fi + + if [ "${PR_NUMBER}" = "" ] ; then + echo "PR_NUMBER not found, exiting." + exit 1 + fi + # If triggered by merge queue, the PR number is not available in the payload. While we restrict the number of PRs in the # queue to 1, we can get the PR number by parsing the merge queue temp branch's ref. - name: Get PR metadata (merge queue) @@ -213,6 +229,21 @@ jobs: echo "comparison sha is: ${COMPARISON_SHA}" echo "comparison tag is: ${COMPARISON_TAG}" + if [ "${BASELINE_SHA}" = "" ] ; then + echo "BASELINE_SHA not found, exiting." + exit 1 + fi + + if [ "${COMPARISON_SHA}" = "" ] ; then + echo "COMPARISON_SHA not found, exiting." + exit 1 + fi + + if [ "${PR_NUMBER}" = "" ] ; then + echo "PR_NUMBER not found, exiting." + exit 1 + fi + - name: Setup experimental metadata id: experimental-meta run: |