Skip to content

Commit

Permalink
Clone the PR's merge branch vs head in e2e tests
Browse files Browse the repository at this point in the history
This configures actions/checkout to clone the PR's merge
branch (instead of the PR's head), to align with how unit/functional
tests work and ensure that all of our tests are testing against the
same codebase - the state of the code as it would look after the PR
merges, to get an accurate picture of whether things will pass if this
merges or not.

Fixes #482

Signed-off-by: Ben Browning <[email protected]>
  • Loading branch information
bbrowning committed Jan 17, 2025
1 parent 695c651 commit b1979c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/e2e-nvidia-l4-x1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ jobs:
- name: Checkout instructlab/sdg
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "instructlab/sdg"
path: "sdg"
# https://github.com/actions/checkout/issues/249
fetch-depth: 0
Expand All @@ -105,8 +104,10 @@ jobs:
if: ${{ github.event_name == 'pull_request_target' }}
working-directory: ./sdg
run: |
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
git checkout pr-${{ github.event.pull_request.number }}
git fetch origin pull/${{ github.event.pull_request.number }}/merge:pr-merge-${{ github.event.pull_request.number }}
git checkout pr-merge-${{ github.event.pull_request.number }}
git log -1 --format="%H %s"
- name: Install ilab
working-directory: ./instructlab
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/e2e-nvidia-l40s-x4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ jobs:
- name: Checkout instructlab/sdg
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "instructlab/sdg"
path: "sdg"
# https://github.com/actions/checkout/issues/249
fetch-depth: 0
Expand Down Expand Up @@ -129,15 +128,17 @@ jobs:
if: steps.check_pr.outputs.is_pr == 'true'
working-directory: ./sdg
run: |
gh pr checkout ${{ steps.check_pr.outputs.pr_or_branch }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
git fetch origin pull/${{ steps.check_pr.outputs.pr_or_branch }}/merge:pr-merge-${{ steps.check_pr.outputs.pr_or_branch }}
git checkout pr-merge-${{ steps.check_pr.outputs.pr_or_branch }}
git log -1 --format="%H %s"
- name: Checkout branch
if: steps.check_pr.outputs.is_pr == 'false'
working-directory: ./sdg
run: |
git checkout ${{ steps.check_pr.outputs.pr_or_branch }}
git log -1 --format="%H %s"
- name: Install ilab
working-directory: ./instructlab
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-nvidia-t4-x1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ jobs:
- name: Checkout instructlab/sdg
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: "instructlab/sdg"
path: "sdg"
# https://github.com/actions/checkout/issues/249
fetch-depth: 0
Expand All @@ -105,8 +104,9 @@ jobs:
if: github.event_name == 'pull_request_target'
working-directory: ./sdg
run: |
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-${{ github.event.pull_request.number }}
git checkout pr-${{ github.event.pull_request.number }}
git fetch origin pull/${{ github.event.pull_request.number }}/merge:pr-merge-${{ github.event.pull_request.number }}
git checkout pr-merge-${{ github.event.pull_request.number }}
git log -1 --format="%H %s"
- name: Install ilab
working-directory: ./instructlab
Expand Down

0 comments on commit b1979c6

Please sign in to comment.