From 1d62f0b709cfced8b4dfcd0510cb554b4e3dbe90 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 2 Nov 2021 14:34:59 +0100 Subject: ci: Update Java Github Actions workflows This change updates the Github Actions workflows for the Java/Kotlin part of the project. We now use the gradle-build-action from Gradle to build the project, which does caching for us. In addition, we update the Codecov action to version 2, since the old version is deprecated and will stop working next year. --- .github/workflows/build.yml | 37 ++++++++++++------------------------- .github/workflows/release.yml | 26 +++++--------------------- 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bd42254..d72ad63e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,8 @@ on: branches: [master] jobs: - build-simulator: - name: Build Simulator (Java ${{ matrix.java }}) + build: + name: Build (Java ${{ matrix.java }}) runs-on: ${{ matrix.os }} strategy: matrix: @@ -23,30 +23,17 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: + distribution: 'zulu' java-version: ${{ matrix.java }} - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.java }}-gradle- - name: Build with Gradle - run: ./gradlew classes - - name: Check with Gradle - run: ./gradlew check codeCoverageReport - - name: Cleanup Gradle Daemons - run: ./gradlew --stop - - name: Cleanup Gradle Cache - run: | - rm -f ~/.gradle/caches/modules-2/modules-2.lock - rm -f ~/.gradle/caches/modules-2/gc.properties - shell: bash + uses: gradle/gradle-build-action@v2 + with: + arguments: build codeCoverageReport + # Only write to the cache for builds on the 'main' branch. + # Builds on other branches will only read existing entries from the cache. + cache-read-only: ${{ github.ref != 'refs/heads/main' }} - name: Publish report if: always() uses: mikepenz/action-junit-report@v2 @@ -64,7 +51,7 @@ jobs: ./**/build/test-results/**/* retention-days: 5 - name: Upload code coverage - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./build/reports/jacoco/report.xml @@ -101,7 +88,7 @@ jobs: report_paths: '**/junit-report.xml' github_token: ${{ secrets.GITHUB_TOKEN }} - name: Upload code coverage - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }} files: opendc-web/opendc-web-api/coverage.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1f2864c..ce1d2a1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,23 +17,14 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 - name: Set up JDK - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: + distribution: 'zulu' java-version: ${{ matrix.java }} - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.java }}-gradle- - - name: Build with Gradle - run: ./gradlew :assembleDist - name: Publish with Gradle - run: ./gradlew publish + uses: gradle/gradle-build-action@v2 + with: + arguments: publish env: ORG_GRADLE_PROJECT_signingKeyId: F8134F9C ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} @@ -48,10 +39,3 @@ jobs: files: build/distributions/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Cleanup Gradle Daemons - run: ./gradlew --stop - - name: Cleanup Gradle Cache - run: | - rm -f ~/.gradle/caches/modules-2/modules-2.lock - rm -f ~/.gradle/caches/modules-2/gc.properties - shell: bash -- cgit v1.2.3 From bdba3965e299687850a36f874bd2c12e63524903 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 2 Nov 2021 14:46:04 +0100 Subject: ci: Add workflows for testing Java and Gradle EA releases This change adds two workflows that test weekly whether OpenDC builds against the latest Gradle release candidate (RC) and Java early access (EA) release. --- .github/workflows/test-gradle-rc.yml | 17 +++++++++++++++++ .github/workflows/test-java-ea.yml | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/test-gradle-rc.yml create mode 100644 .github/workflows/test-java-ea.yml diff --git a/.github/workflows/test-gradle-rc.yml b/.github/workflows/test-gradle-rc.yml new file mode 100644 index 00000000..c03c037a --- /dev/null +++ b/.github/workflows/test-gradle-rc.yml @@ -0,0 +1,17 @@ +name: Test latest Gradle RC +on: + schedule: + - cron: 0 0 * * 0 # weekly + +jobs: + gradle-rc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + java-version: 17 + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: release-candidate + arguments: build --dry-run # just test build configuration diff --git a/.github/workflows/test-java-ea.yml b/.github/workflows/test-java-ea.yml new file mode 100644 index 00000000..a21871b1 --- /dev/null +++ b/.github/workflows/test-java-ea.yml @@ -0,0 +1,18 @@ +name: Test Java EA release +on: + schedule: + - cron: 0 0 * * 0 # weekly + +jobs: + java-ea: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: 18-ea + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: release-candidate + arguments: build -- cgit v1.2.3 From 29abae146139078b1c7254c0e46b5c9e65cc30cd Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 2 Nov 2021 14:59:02 +0100 Subject: build: Update build dependencies --- buildSrc/build.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4eb8ac31..0dab8647 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -31,10 +31,10 @@ repositories { } dependencies { - implementation(kotlin("gradle-plugin", version = "1.5.30")) - implementation("org.jlleitschuh.gradle:ktlint-gradle:10.1.0") - implementation("org.jetbrains.kotlin:kotlin-allopen:1.5.30") + implementation(kotlin("gradle-plugin", version = "1.5.31")) + implementation("org.jlleitschuh.gradle:ktlint-gradle:10.2.0") + implementation("org.jetbrains.kotlin:kotlin-allopen:1.5.31") implementation("me.champeau.jmh:jmh-gradle-plugin:0.6.6") - implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.5.0") + implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.5.30") implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0") } -- cgit v1.2.3