Skip to content

Commit

Permalink
Update github actions.
Browse files Browse the repository at this point in the history
* Do not run tests on auto-merge.
* Run daily tests for release branches.
* Test for all platforms in release action.
  • Loading branch information
neetopia committed Apr 7, 2022
1 parent 3052f52 commit 2712162
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 14 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,8 @@ jobs:
run: ./gradlew :api:checkApi

# Run ksp generated tests
- name: test
run: ./gradlew --stacktrace --info test
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-reports
path: |
compiler-plugin/build/reports
integration-tests/build/reports
gradle-plugin/build/reports
common-util/build/reports
- name: build
run: ./gradlew --stacktrace --info build

- name: push to release branch
run: git push origin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]

# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
on:
# runs on 4:30 AM PST or 5:30 AM PDT
schedule:
- cron: '30 12 * * *'
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]

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
22 changes: 21 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]

# The type of runner that the job will run on
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- name: Setup Java 9
Expand Down Expand Up @@ -50,14 +52,32 @@ jobs:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

# 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
# Build KSP artifacts
- name: build
if: matrix.os == 'ubuntu-latest'
run: |
REF=${{ github.ref }} # refs/tags/$KSP_VERSION
./gradlew --info -PkspVersion=${REF:10} -PoutRepo=$(pwd)/build/repos/release publishAllPublicationsToMavenRepository
- name: pack
if: matrix.os == 'ubuntu-latest'
run: cd build/repos/release/ && zip -r ../../artifacts.zip .
- name: Upload Release Asset
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 2712162

Please sign in to comment.