Skip to content

Commit c10366e

Browse files
committed
Extract tests for each platform into separate jobs. Do not run tests on publishing
1 parent abd91f5 commit c10366e

File tree

4 files changed

+81
-54
lines changed

4 files changed

+81
-54
lines changed

.github/workflows/build-and-test.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build and test on different host systems
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
upload-code-coverage:
7+
type: boolean
8+
description: "enabled uploading coverage report to codecov"
9+
required: false
10+
default: false
11+
secrets:
12+
CODECOV_TOKEN:
13+
description: "token to upload codecov report"
14+
required: false
15+
jobs:
16+
check-style:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 'Checkout Repository'
20+
uses: actions/checkout@v4
21+
- uses: actions/setup-java@v4
22+
with:
23+
distribution: temurin
24+
java-version-file: .java-version
25+
- name: Validate Gradle Wrapper
26+
uses: gradle/actions/wrapper-validation@v3
27+
- name: Cache konan
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.konan
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
32+
restore-keys: |
33+
${{ runner.os }}-gradle-
34+
- name: Cache unicode data
35+
uses: actions/cache@v4
36+
with:
37+
path: build/unicode_dump
38+
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
39+
restore-keys: |
40+
unicode-dump-
41+
- name: Setup Gradle
42+
uses: gradle/actions/setup-gradle@v3
43+
with:
44+
gradle-version: wrapper
45+
- name: Build
46+
run: ./gradlew --no-daemon --continue detekt detektAll ktlintCheck apiCheck
47+
check-linux:
48+
uses: ./.github/workflows/check.yml
49+
with:
50+
run-on: ubuntu-latest
51+
task: linuxAllTest
52+
upload-code-coverage: ${{ inputs.upload-code-coverage }}
53+
secrets:
54+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55+
check-macos:
56+
uses: ./.github/workflows/check.yml
57+
with:
58+
run-on: macos-latest
59+
task: macOsAllTest
60+
check-windows:
61+
uses: ./.github/workflows/check.yml
62+
with:
63+
run-on: windows-latest
64+
task: windowsAllTest

.github/workflows/pull_request.yml

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,52 +11,9 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14-
check-style:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: 'Checkout Repository'
18-
uses: actions/checkout@v4
19-
- uses: actions/setup-java@v4
20-
with:
21-
distribution: temurin
22-
java-version-file: .java-version
23-
- name: Validate Gradle Wrapper
24-
uses: gradle/actions/wrapper-validation@v3
25-
- name: Cache konan
26-
uses: actions/cache@v4
27-
with:
28-
path: ~/.konan
29-
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
30-
restore-keys: |
31-
${{ runner.os }}-gradle-
32-
- name: Cache unicode data
33-
uses: actions/cache@v4
34-
with:
35-
path: build/unicode_dump
36-
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
37-
restore-keys: |
38-
unicode-dump-
39-
- name: Setup Gradle
40-
uses: gradle/actions/setup-gradle@v3
41-
with:
42-
gradle-version: wrapper
43-
- name: Build
44-
run: ./gradlew --no-daemon --continue detekt detektAll ktlintCheck apiCheck
45-
check-linux:
46-
uses: ./.github/workflows/check.yml
14+
check-pr:
15+
uses: ./.github/workflows/build-and-test.yml
4716
with:
48-
run-on: ubuntu-latest
49-
task: linuxAllTest
5017
upload-code-coverage: true
5118
secrets:
5219
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53-
check-macos:
54-
uses: ./.github/workflows/check.yml
55-
with:
56-
run-on: macos-latest
57-
task: macOsAllTest
58-
check-windows:
59-
uses: ./.github/workflows/check.yml
60-
with:
61-
run-on: windows-latest
62-
task: windowsAllTest

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ jobs:
2424
version-source: file
2525
version-file: ${{ env.VERSION_FILE }}
2626
version-file-extraction-pattern: ${{ env.VERSION_PATTERN }}
27+
build-and-test:
28+
uses: ./.github/workflows/build-and-test.yml
2729
publish_artifacts:
2830
needs:
2931
- version
32+
- build-and-test
3033
runs-on: macos-latest
3134
steps:
3235
- name: 'Checkout Repository'
@@ -61,7 +64,7 @@ jobs:
6164
with:
6265
gradle-version: wrapper
6366
- name: Build and publish release
64-
run: ./gradlew --no-daemon --info build publish closeAndReleaseStagingRepository -Pversion=${{ needs.version.outputs.RELEASE_VERSION }} -x :benchmark:benchmark
67+
run: ./gradlew --no-daemon --info assemble publish closeAndReleaseStagingRepository -Pversion=${{ needs.version.outputs.RELEASE_VERSION }} -x :benchmark:benchmark
6568
env:
6669
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
6770
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}

.github/workflows/snapshot_release.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ on:
1212
- '.github/workflows/benchmark.yml'
1313

1414
jobs:
15+
build-and-test:
16+
uses: ./.github/workflows/build-and-test.yml
17+
with:
18+
upload-code-coverage: true
19+
secrets:
20+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1521
publish:
22+
needs:
23+
- build-and-test
1624
runs-on: macos-latest
1725
steps:
1826
- name: 'Checkout Repository'
@@ -51,17 +59,12 @@ jobs:
5159
./gradlew
5260
--no-daemon
5361
--info
54-
build publish koverXmlReport
62+
assemble
63+
publish
5564
-x :benchmark:benchmark
56-
-x :linkDebugTestLinuxX64
57-
-x :test-suites:linkDebugTestLinuxX64
5865
env:
5966
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
6067
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
6168
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}
6269
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
63-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
64-
- name: Upload coverage reports to Codecov
65-
uses: codecov/codecov-action@v4
66-
with:
67-
token: ${{ secrets.CODECOV_TOKEN }}
70+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

0 commit comments

Comments
 (0)