diff options
Diffstat (limited to '.github/workflows/main.yml')
-rw-r--r-- | .github/workflows/main.yml | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..747039b1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,80 @@ +# Workflow to run tests + +name: CI + +on: + push: + branches: [ main, 1.0.10-release, 1.0.9-release ] + pull_request: + branches: [ main, 1.0.10-release, 1.0.9-release ] + +jobs: + build-and-test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + # The type of runner that the job will run on + runs-on: ${{ matrix.os }} + + steps: + - name: Setup Java 9 + uses: actions/setup-java@v1.4.3 + with: + java-version: '9' + java-package: jdk + architecture: x64 + - name: set JDK_9 environment variable for kotlin compiler + shell: bash + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + run: echo ::set-env name=JDK_9::$(echo $JAVA_HOME) + - name: Setup Java 11 + uses: actions/setup-java@v1.4.3 + with: + java-version: '11' + java-package: jdk + architecture: x64 + + # Checkout + - uses: actions/checkout@v2 + + # Build cache + - name: Cache Gradle Cache + uses: actions/cache@v2 + 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@v2 + with: + path: ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} + # Run ktlint + - name: lint + if: matrix.os == 'ubuntu-latest' + run: ./gradlew ktlint + + # Check API compatibility + - name: API compatibility check + if: matrix.os == 'ubuntu-latest' + run: ./gradlew :api:checkApi + + # Run tests + - name: test + shell: bash + run: ./gradlew --stacktrace --info test + - name: Upload test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-reports-${{ matrix.os }} + path: | + compiler-plugin/build/reports + integration-tests/build/reports + gradle-plugin/build/reports + common-util/build/reports |