Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
* use arm macos on CI
* update versions of actions
* minor cleanup
* split jvm runs
  • Loading branch information
whyoleg committed May 13, 2024
1 parent 4739eac commit a09b752
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 168 deletions.
56 changes: 24 additions & 32 deletions .github/actions/setup-gradle/action.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,38 @@
name: "Setup Gradle"
description: "Setup konan relocation and gradle caching specific to kotlin MPP"
name: 'Setup Gradle'
description: 'Setup JDK and Gradle'
inputs:
os:
required: true
description: "OS"
default: ${{ matrix.os }}
cache-disabled:
description: When 'true', all caching is disabled. No entries will be written to or read from the cache.
required: false
default: false
description: 'gradle.cache-disabled'
default: 'false'
cache-read-only:
description: |
When 'true', existing entries will be read from the cache but no entries will be written.
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
required: false
default: ${{ github.event.repository != null && github.ref_name != github.event.repository.default_branch }}
description: 'gradle.cache-read-only'
default: 'true'
runs:
# noinspection YAMLSchemaValidation
using: "composite"
using: 'composite'
steps:
- if: inputs.os != 'windows-latest'
run: echo "KONAN_DATA_DIR=${HOME}/.gradle/konan" >> $GITHUB_ENV
shell: bash
- if: inputs.os == 'windows-latest'
run: echo "KONAN_DATA_DIR=${USERPROFILE}\.gradle\konan" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-java@v3
# On Windows/Linux runners temurin JDK 8, 11, 17, 21 are cached
# On macOS arm64 runners temurin JDK 11, 17, 21 are cached; temurin JDK 8 is not available to download
- uses: actions/setup-java@v4
with:
distribution: ${{ (runner.os == 'macOS' && runner.arch == 'ARM64') && 'zulu' || 'temurin' }}
java-version: 8
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
# the latest listed version will be used for executions of Gradle
java-version: |
8
11
17
21
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

validate-wrappers: true

cache-disabled: ${{ inputs.cache-disabled }}
cache-read-only: ${{ inputs.cache-read-only }}
gradle-home-cache-includes: |
caches
notifications
konan
nodejs
yarn

gradle-home-cache-cleanup: true
10 changes: 4 additions & 6 deletions .github/workflows/ci-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
os: [ ubuntu-latest, windows-latest, macos-14 ]
sample: [ chat ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-gradle
with:
cache-read-only: true
- uses: gradle/gradle-build-action@v2
with:
arguments: build --continue
build-root-directory: samples/${{ matrix.sample }}
- run: ./gradlew build --continue
working-directory: samples/${{ matrix.sample }}
27 changes: 8 additions & 19 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,32 @@ name: Publish RELEASE to Maven Central
on:
workflow_call:

concurrency:
group: publish-release
cancel-in-progress: false

jobs:
publish:
if: github.repository == 'rsocket/rsocket-kotlin'
runs-on: macos-latest
concurrency:
group: publish-release
cancel-in-progress: false
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-gradle
with:
cache-disabled: true

- name: Publish to Maven Local (prepare packages)
uses: gradle/gradle-build-action@v2
run: ./gradlew publishToMavenLocal -Pversion=${{ github.ref_name }} --no-configuration-cache
env:
ORG_GRADLE_PROJECT_signingKey: ${{secrets.signingKey}}
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.signingPassword}}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.sonatypeUsername}}
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.sonatypePassword}}
with:
arguments: |
publishToMavenLocal
--scan
--info
-Pversion=${{ github.ref_name }}

- name: Publish release to Maven Central (version ${{ github.ref_name }})
uses: gradle/gradle-build-action@v2
run: ./gradlew publishAllPublicationsToMavenCentralRepository -Pversion=${{ github.ref_name }} --no-configuration-cache
env:
ORG_GRADLE_PROJECT_signingKey: ${{secrets.signingKey}}
ORG_GRADLE_PROJECT_signingPassword: ${{secrets.signingPassword}}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.sonatypeUsername}}
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.sonatypePassword}}
with:
arguments: |
publishAllPublicationsToSonatypeRepository
--scan
--info
-Pversion=${{ github.ref_name }}
32 changes: 9 additions & 23 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ on:
type: boolean
required: true

concurrency:
group: publish-snapshot-${{ github.ref_name }}
cancel-in-progress: false

jobs:
publish:
if: github.repository == 'rsocket/rsocket-kotlin'
runs-on: macos-latest
concurrency:
group: publish-snapshot-${{ github.ref_name }}
cancel-in-progress: false
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-gradle
with:
cache-read-only: true

- if: inputs.add-branch-suffix
id: set-version
run: |
Expand All @@ -26,23 +28,7 @@ jobs:
echo "::set-output name=version-suffix::$branch_name"
- name: Publish to Maven Local (prepare packages)
uses: gradle/gradle-build-action@v2
with:
arguments: |
publishToMavenLocal
--scan
--info
-PversionSuffix=${{ steps.set-version.outputs.version-suffix }}
-PgithubUsername=${{ github.actor }}
-PgithubPassword=${{ github.token }}
run: ./gradlew publishToMavenLocal -PversionSuffix=${{ steps.set-version.outputs.version-suffix }} -PgithubUsername=${{ github.actor }} -PgithubPassword=${{ github.token }} --no-configuration-cache

- name: Publish snapshot to Github Packages (version x.y.z-${{ steps.set-version.outputs.version-suffix }}-SNAPSHOT)
uses: gradle/gradle-build-action@v2
with:
arguments: |
publishAllPublicationsToGithubRepository
--scan
--info
-PversionSuffix=${{ steps.set-version.outputs.version-suffix }}
-PgithubUsername=${{ github.actor }}
-PgithubPassword=${{ github.token }}
run: ./gradlew publishAllPublicationsToGithubRepository -PversionSuffix=${{ steps.set-version.outputs.version-suffix }} -PgithubUsername=${{ github.actor }} -PgithubPassword=${{ github.token }} --no-configuration-cache
126 changes: 38 additions & 88 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,123 +1,73 @@
name: Run tests on all platforms
on: [ workflow_call, workflow_dispatch ]

defaults:
run:
shell: bash

jobs:
jvm-test:
name: Run JVM tests
runs-on: ubuntu-latest
build-project:
name: Build project on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'macos-14', 'windows-latest' ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-gradle
- name: Run tests
timeout-minutes: 15
uses: gradle/gradle-build-action@v2
with:
arguments: |
jvmTest
jvm11Test
jvm17Test
jvm21Test
--scan
--info
--continue
- if: always()
uses: actions/upload-artifact@v3
with:
name: test-reports
path: "**/build/test-results/*Test/TEST-*.xml"
retention-days: 1
cache-read-only: ${{ github.ref_name != 'main' }}

js-test:
name: Run JS tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-gradle
- name: Run tests
timeout-minutes: 15
uses: gradle/gradle-build-action@v2
with:
arguments: |
jsNodeTest
jsBrowserTest
--scan
--info
--continue
- if: always()
uses: actions/upload-artifact@v3
with:
name: test-reports
path: "**/build/test-results/*Test/TEST-*.xml"
retention-days: 1
- run: ./gradlew build publishToMavenLocal --continue -Prsocketbuild.skipTests=true

native-test:
name: Run Native(${{ matrix.target }}) tests
run-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest ]
target: [ macosX64, iosX64, tvosX64, watchosX64 ]
os: [ 'ubuntu-latest' ]
target: [ 'jvm', 'jvm11', 'jvm17', 'jvm21', 'js', 'native' ]
include:
- os: ubuntu-latest
target: linuxX64
- os: windows-latest
target: mingwX64
- os: 'macos-14'
target: 'macos'
- os: 'macos-14'
target: 'ios'
- os: 'macos-14'
target: 'watchos'
- os: 'macos-14'
target: 'tvos'
- os: 'windows-latest'
target: 'native'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-gradle
- name: Run tests

- run: ./gradlew ${{ matrix.target }}Test --continue
timeout-minutes: 30
uses: gradle/gradle-build-action@v2
with:
arguments: |
${{ matrix.target }}Test
${{ matrix.target }}ReleaseTest
--scan
--info
--continue
- if: always()
uses: actions/upload-artifact@v3

- if: always() && !cancelled()
uses: actions/upload-artifact@v4
with:
name: test-reports
name: test-reports-${{ matrix.os }}-${{ matrix.target }}
path: "**/build/test-results/*Test/TEST-*.xml"
retention-days: 1

publish-test-results:
needs: [ jvm-test, js-test, native-test ]
needs: [ run-tests ]
if: always()
name: Publish test report
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: test-reports
pattern: test-reports-*
path: test-reports
merge-multiple: 'true'
- name: Publish Test Report
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: test-reports/**/TEST-*.xml

build-project:
name: Build project on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-gradle
- name: Build project without running tests
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
publishToMavenLocal
--scan
--info
--continue
-Prsocketbuild.skipTests=true

0 comments on commit a09b752

Please sign in to comment.