• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Workflow to run tests
2
3name: CI
4
5on:
6  push:
7    branches: [ main, 1.0.10-release, 1.0.9-release ]
8  pull_request:
9    branches: [ main, 1.0.10-release, 1.0.9-release ]
10
11jobs:
12  build-and-test:
13    strategy:
14      fail-fast: false
15      matrix:
16        os: [ubuntu-latest, macos-latest]
17
18    # The type of runner that the job will run on
19    runs-on: ${{ matrix.os }}
20
21    steps:
22    - name: Setup Java 9
23      uses: actions/setup-java@v1.4.3
24      with:
25        java-version: '9'
26        java-package: jdk
27        architecture: x64
28    - name: set JDK_9 environment variable for kotlin compiler
29      shell: bash
30      env:
31        ACTIONS_ALLOW_UNSECURE_COMMANDS: true
32      run: echo ::set-env name=JDK_9::$(echo $JAVA_HOME)
33    - name: Setup Java 11
34      uses: actions/setup-java@v1.4.3
35      with:
36        java-version: '11'
37        java-package: jdk
38        architecture: x64
39
40    # Checkout
41    - uses: actions/checkout@v2
42
43    # Build cache
44    - name: Cache Gradle Cache
45      uses: actions/cache@v2
46      with:
47        path: ~/.gradle/caches
48        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('**/gradle.properties') }}
49        # An ordered list of keys to use for restoring the cache if no cache hit occurred for key
50        restore-keys: |
51          ${{ runner.os }}-gradle-
52    - name: Cache gradle wrapper
53      uses: actions/cache@v2
54      with:
55        path: ~/.gradle/wrapper
56        key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
57    # Run ktlint
58    - name: lint
59      if: matrix.os == 'ubuntu-latest'
60      run: ./gradlew ktlint
61
62    # Check API compatibility
63    - name: API compatibility check
64      if: matrix.os == 'ubuntu-latest'
65      run: ./gradlew :api:checkApi
66
67    # Run tests
68    - name: test
69      shell: bash
70      run: ./gradlew --stacktrace --info test
71    - name: Upload test results
72      if: always()
73      uses: actions/upload-artifact@v3
74      with:
75        name: test-reports-${{ matrix.os }}
76        path: |
77          compiler-plugin/build/reports
78          integration-tests/build/reports
79          gradle-plugin/build/reports
80          common-util/build/reports
81