Skip to content

Commit eaf36db

Browse files
authored
Introduce a separate GHA workflow for Pull Request Validation to validate the correct commit hashes (#269)
## Summary This PR adds a new workflow which largely reuses the existing workflow for building/creating images, except that it runs on pull requests but also uses the correct hashes. The PR workflow also has some optimizations to cancel the previous test run on the same PR if a new commit is pushed since that test result is outdated. <!--- HINT: Replace #nnn with corresponding Issue number, if you are fixing an existing issue --> [Issue](https://github.com/linkedin/openhouse/issues/#nnn)] Briefly discuss the summary of the changes made in this pull request in 2-3 lines. For all the boxes checked, please include additional details of the changes made in this pull request. The workflow on the main branch appears to be using the merge commit SHA for tagging purposes: https://github.com/anothrNick/github-tag-action However this causes issues where it can use outdated hashes of pull requests due to using `github.event.pull_request.merge_commit_sha` which does not seem consistent with the Pull Request HEAD SHA. Documentation on the default behavior here that should fix it https://github.com/actions/checkout/blob/main/README.md This can cause PRs to have breaking commits but due to this workflow file can pass the CI tests, making it difficult to work in the repository. Another side effect of the PR is that committers branches that have multiple commits may have difficulty debugging their failing workflows locally since the CI tests are running on outdated files. See testing below for replication of the issue. ## Changes - [ ] Client-facing API Changes - [ ] Internal API Changes - [x] Bug Fixes - [ ] New Features - [ ] Performance Improvements - [ ] Code Style - [ ] Refactoring - [ ] Documentation - [ ] Tests ## Testing Done <!--- Check any relevant boxes with "x" --> - [ ] Manually Tested on local docker setup. Please include commands ran, and their output. - [ ] Added new tests for the changes made. - [ ] Updated existing tests to reflect the changes made. - [ ] No tests added or updated. Please explain why. If unsure, please feel free to ask for help. - [x] Some other form of testing like staging or soak time in production. Please explain. For all the boxes checked, include a detailed description of the testing done for the changes made in this pull request. Tested locally on my repo Will-Lo#1 shows a PR with the old behavior which has a clearly breaking change, but is passing tests since the commit that opened the PR passed tests Will-Lo#3 shows a PR that used to pass with the commit that opened it, but now fails with the same breaking change. # Additional Information - [ ] Breaking Changes - [ ] Deprecations - [ ] Large PR broken into smaller PRs, and PR plan linked in the description. For all the boxes checked, include additional details of the changes made in this pull request.
1 parent 7b341c8 commit eaf36db

File tree

3 files changed

+63
-36
lines changed

3 files changed

+63
-36
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Gradle Build and Run Tests
2+
3+
on:
4+
workflow_call: # Allow to be run by other workflows
5+
6+
jobs:
7+
build-and-run-tests:
8+
name: Build and Run Tests
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout project sources
12+
uses: actions/checkout@v4
13+
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v1
16+
with:
17+
distribution: 'microsoft'
18+
java-version: '17'
19+
20+
- name: Validate Gradle Wrapper
21+
uses: gradle/wrapper-validation-action@v1
22+
23+
- name: Build with Gradle
24+
run: ./gradlew clean build
25+
26+
- name: Start Docker Containers
27+
run: docker compose -f infra/recipes/docker-compose/oh-only/docker-compose.yml up -d --build
28+
29+
- name: Wait for Docker Containers to start
30+
run: sleep 30
31+
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.x'
36+
37+
- name: Install dependencies
38+
run: pip install -r scripts/python/requirements.txt
39+
40+
- name: Run Integration Tests
41+
run: python scripts/python/integration_test.py ./tables-test-fixtures/tables-test-fixtures-iceberg-1.2/src/main/resources/dummy.token
42+
43+
- name: Stop Docker Containers
44+
run: docker compose -f infra/recipes/docker-compose/oh-only/docker-compose.yml down

.github/workflows/build-tag-publish.yml

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,20 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
8-
types: [opened, synchronize, reopened]
97

108
jobs:
11-
build-gradle-project:
9+
build-and-run-tests:
10+
uses: ./.github/workflows/build-run-tests.yml
11+
12+
tag-publish-gradle:
1213
name: Build tagged commit
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout project sources
1617
uses: actions/checkout@v4
1718
with:
18-
ref: ${{ github.event.pull_request.merge_commit_sha }}
1919
fetch-depth: 0
2020

21-
- name: Set up JDK 17
22-
uses: actions/setup-java@v1
23-
with:
24-
distribution: 'microsoft'
25-
java-version: '17'
26-
27-
- name: Validate Gradle Wrapper
28-
uses: gradle/wrapper-validation-action@v1
29-
30-
- name: Build with Gradle
31-
run: ./gradlew clean build
32-
33-
- name: Start Docker Containers
34-
run: docker compose -f infra/recipes/docker-compose/oh-only/docker-compose.yml up -d --build
35-
36-
- name: Wait for Docker Containers to start
37-
run: sleep 30
38-
39-
- name: Set up Python
40-
uses: actions/setup-python@v5
41-
with:
42-
python-version: '3.x'
43-
44-
- name: Install dependencies
45-
run: pip install -r scripts/python/requirements.txt
46-
47-
- name: Run Integration Tests
48-
run: python scripts/python/integration_test.py ./tables-test-fixtures/tables-test-fixtures-iceberg-1.2/src/main/resources/dummy.token
49-
50-
- name: Stop Docker Containers
51-
run: docker compose -f infra/recipes/docker-compose/oh-only/docker-compose.yml down
52-
5321
- name: Bump version and push tag
5422
if: ${{ success() && github.ref == 'refs/heads/main' && github.repository == 'linkedin/openhouse' }}
5523
uses: anothrNick/[email protected]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Pull Request Validations
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ci-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build-run-tests:
15+
uses: ./.github/workflows/build-run-tests.yml

0 commit comments

Comments
 (0)