blob: 0beaf4c11caeca491df0fcc4f8502372d1e90db1 [file]
# 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:
branches: [ main, '[0-9]+.[0-9]+.[0-9]+-release*' ]
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@v5
with:
java-version: '17'
distribution: 'zulu'
# Checkout
- uses: actions/checkout@v6
# Build cache
- name: Cache Gradle Cache
uses: actions/cache@v5
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
# 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@v5
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- 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@v7
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