Skip to content

Commit

Permalink
Add Github Workflow file to run tests in pre/post-submit (#116)
Browse files Browse the repository at this point in the history
* add workflow file to test builds on CI

* log env variables, see if it works.

* log java home

* use set-env for environment variables.

* clean workflow file
  • Loading branch information
yigit committed Oct 7, 2020
1 parent 167d88a commit 3077421
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,62 @@
# Workflow to run tests

name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build-and-test:
strategy:
fail-fast: false

# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:
- name: Setup Java 8
uses: actions/setup-java@v1.4.3
with:
java-version: '8'
java-package: jdk
architecture: x64
- name: set JDK 6,7,8 environment variables for kotlin compiler
run: echo ::set-env name=JDK_16::$(echo $JAVA_HOME) && echo ::set-env name=JDK_17::$(echo $JAVA_HOME) && echo ::set-env name=JDK_18::$(echo $JAVA_HOME)
- 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
run: echo ::set-env name=JDK_9::$(echo $JAVA_HOME)

# 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 ksp generated tests
- name: test
run: ./gradlew --info :compiler-plugin:test --tests "com.google.devtools.ksp.test.KotlinKSPTestGenerated.*" -PcompilerTestEnabled=true
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-reports
path: compiler-plugin/build/reports

0 comments on commit 3077421

Please sign in to comment.