Skip to content

Commit bbc7a8f

Browse files
authored
Refactor workflow, run on main (#251)
* Refactor workflow - Rename workflow to 'Build' - Add push trigger on main branch - Cancel workflow only when the run is NOT on `main` branch - Update Gradle setup * fix CodeQL * Update CodeQL workflow and Gradle properties - Enable ignoring disabled targets for Kotlin Native. - Refine CodeQL build command to specify module targets and rerun tasks. * Fix auto-merge condition in workflow - Adjust failure condition to only disable auto-merge for pull requests.
1 parent c455974 commit bbc7a8f

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.github/workflows/validate-pr.yml renamed to .github/workflows/build.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
name: Validate PR
1+
name: Build
22

33
on:
44
workflow_dispatch:
55
pull_request:
66
branches: [ main ]
7+
push:
8+
branches: [ main ]
79

810
concurrency:
9-
group: ${{ github.workflow }}-${{ github.ref }}
10-
cancel-in-progress: true
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
# Cancel only when the run is NOT on `main` branch
13+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1114

1215
jobs:
1316
validate-pr:
@@ -24,8 +27,11 @@ jobs:
2427

2528
- name: Setup Gradle
2629
uses: gradle/actions/setup-gradle@v4
30+
with:
31+
add-job-summary: 'always'
32+
cache-read-only: true
2733

28-
- name: Clean Build with Gradle
34+
- name: Build with Gradle
2935
run: ./gradlew clean build
3036

3137
- name: Upload JUnit test results
@@ -36,7 +42,7 @@ jobs:
3642
path: '**/build/test-results/test/*.xml'
3743

3844
- name: Disable Auto-Merge on Fail
39-
if: failure()
45+
if: failure() && github.event_name == 'pull_request'
4046
run: gh pr merge --disable-auto "$PR_URL"
4147
env:
4248
PR_URL: ${{github.event.pull_request.html_url}}

.github/workflows/codeql.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ jobs:
2929

3030
steps:
3131
- name: Checkout repository
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@v5
33+
with:
34+
fetch-depth: 0
3335

3436
- uses: actions/setup-java@v5
3537
with:
@@ -52,14 +54,14 @@ jobs:
5254

5355
- name: Build Kotlin sources
5456
run: |
55-
./gradlew \
57+
./gradlew \
5658
:kotlin-sdk-core:compileKotlinJvm \
5759
:kotlin-sdk-client:compileKotlinJvm \
5860
:kotlin-sdk-server:compileKotlinJvm \
5961
:kotlin-sdk:compileKotlinJvm \
6062
:kotlin-sdk-test:compileKotlinJvm \
6163
-Pkotlin.incremental=false \
62-
--no-daemon --stacktrace
64+
--no-daemon --stacktrace --rerun-tasks
6365
6466
- name: Analyze
6567
uses: github/codeql-action/analyze@v3

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ kotlin.code.style=official
99
kotlin.daemon.jvmargs=-Xmx4G
1010
# MPP
1111
kotlin.mpp.enableCInteropCommonization=true
12+
kotlin.native.ignoreDisabledTargets=true

0 commit comments

Comments
 (0)