-
Notifications
You must be signed in to change notification settings - Fork 415
139 lines (117 loc) · 5.66 KB
/
Copy pathmain.yml
File metadata and controls
139 lines (117 loc) · 5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Workflow to run tests
name: CI
on:
push:
branches: [ main, '[0-9]+.[0-9]+.[0-9]+-release*' ]
pull_request:
branches: [ main, '[0-9]+.[0-9]+.[0-9]+-release*' ]
workflow_dispatch:
merge_group:
types: [ checks_requested ]
permissions: { }
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
test-suite: [ api-check, unit-test, integration-test-primary, integration-test-secondary, integration-test-android, integration-test-agp, gradle-check ]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.test-suite == 'integration-test-secondary' || matrix.test-suite == 'integration-test-android' || matrix.test-suite == 'integration-test-agp' }}
defaults:
run:
shell: bash
steps:
- name: Free Disk Space (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
echo "Disk space before cleanup:"
df -h
set -xe
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /opt/hostedtoolcache/
sudo rm -rf /usr/local/graalvm/
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo docker image prune --all --force
echo "Disk space after cleanup:"
df -h
- name: Setup Java 17
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95
with:
java-version: '17'
distribution: 'zulu'
# Checkout
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Check valid Gradle wrapper jar
if: matrix.os != 'windows-latest'
run: sha256sum --check gradle-wrapper.jar.sha256sum
working-directory: ./gradle/wrapper
# Build cache
- name: Cache Gradle Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}-${{ hashFiles('**/libs.versions.toml') }}
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache gradle wrapper
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Check valid Gradle wrapper jar
if: matrix.os != 'windows-latest'
run: sha256sum --check gradle-wrapper.jar.sha256sum
working-directory: ./gradle/wrapper
- name: API compatibility check
if: matrix.os == 'ubuntu-latest' && matrix.test-suite == 'api-check'
run: ./gradlew :api:checkApi
- name: Run unit tests
if: matrix.test-suite == 'unit-test'
run: ./gradlew :kotlin-analysis-api:test --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run primary integration tests
if: matrix.test-suite == 'integration-test-primary'
run: ./gradlew :integration-tests:primaryTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run secondary integration tests
if: matrix.test-suite == 'integration-test-secondary'
run: ./gradlew :integration-tests:secondaryTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run android integration tests
if: matrix.test-suite == 'integration-test-android'
run: ./gradlew :integration-tests:androidTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run agp integration tests
if: matrix.test-suite == 'integration-test-agp'
run: ./gradlew :integration-tests:agpTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Run remaining tests and checks
if: matrix.test-suite == 'gradle-check'
run: ./gradlew check -x :kotlin-analysis-api:test -x :integration-tests:primaryTest -x :integration-tests:secondaryTest -x :integration-tests:androidTest -x :integration-tests:agpTest --stacktrace --info --max-workers=1 --no-parallel -Dorg.gradle.vfs.watch=false -Dorg.gradle.jvmargs="-Xmx20248m -Dkotlin.daemon.jvm.options=-Xmx2048m"
- name: Upload test results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: test-reports-${{ matrix.test-suite }}-${{ matrix.os }}
path: |
integration-tests/build/reports
gradle-plugin/build/reports
common-util/build/reports
kotlin-analysis-api/build/reports
all-checks-passed:
name: all-checks-passed
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- name: Verify test results
env:
TEST_RESULT: ${{ needs.test.result }}
run: |
if [ "$TEST_RESULT" != "success" ]; then
echo "One or more required test suites (api-check, unit-test, integration-test-primary, gradle-check) failed. Result: $TEST_RESULT"
exit 1
fi
echo "All required test suites (api-check, unit-test, integration-test-primary, gradle-check) passed successfully."