From 62a3580c91d9561bc8a24157681c42995c6b0fd5 Mon Sep 17 00:00:00 2001 From: Marco Sternini Date: Fri, 26 Jan 2024 18:19:45 +0100 Subject: [PATCH 1/3] perf(cd): speed-up workflow using artifacts uploads and downloads --- .github/workflows/build-and-deploy.yml | 48 +++++++++++++++++++------- alchemist-full/build.gradle.kts | 2 +- release.config.js | 1 - 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 3e32acab18..b525f801b8 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -23,7 +23,11 @@ jobs: strategy: fail-fast: false matrix: - os: [ windows-2022, macos-12, ubuntu-22.04 ] + os: [ windows-2022, macos-12] + generateJars: [false] + include: + - os: ubuntu-22.04 + generateJars: true runs-on: ${{ matrix.os }} timeout-minutes: 180 concurrency: @@ -65,6 +69,16 @@ jobs: name: installer-package-${{ runner.os }} path: build/package/* if-no-files-found: error + - name: Generate jars + if: ${{ matrix.generateJars }} + run: ./gradlew shadowJar + - name: Upload FatJars + if: ${{ matrix.generateJars }} + uses: actions/upload-artifact@v4.3.0 + with: + name: fat-jars + path: build/shadow/* + if-no-files-found: error # Performs a dry-deployment if credentials are available test-deploy: needs: @@ -97,10 +111,11 @@ jobs: maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} signing-key: ${{ secrets.SIGNING_KEY }} signing-password: ${{ secrets.SIGNING_PASSWORD }} - # Test jpackage utility - test-packaging: + # Test packages correctness + test-packages: needs: - select-java-version + - build strategy: matrix: os: [ windows-2022, macos-12, ubuntu-22.04 ] @@ -118,16 +133,18 @@ jobs: with: java-version: ${{ needs.select-java-version.outputs.java-version }} distribution: 'temurin' - - name: Dry run - shell: bash - run: ./gradlew jpackage --info -Djpackage.dryRun=true - name: Install bsdtar if: runner.os == 'Linux' run: sudo apt update && sudo apt install libarchive-tools - - name: Test packaging + - name: Download packages + uses: actions/download-artifact@v4.1.1 + with: + name: installer-package-${{ runner.os }} + path: build/package/ + merge-multiple: true + - name: Test package shell: bash - run: ./gradlew testJpackageOutput --info - + run: ./gradlew testJpackageOutput --info # Builds the website and verifies link sanity build-website: needs: @@ -205,7 +222,7 @@ jobs: - build - build-website - test-deploy - - test-packaging + - test-packages runs-on: ubuntu-22.04 if: >- !github.event.repository.fork @@ -235,8 +252,14 @@ jobs: - name: Download packages uses: actions/download-artifact@v4.1.1 with: - path: build/package/ pattern: installer-package-* + path: build/package/ + merge-multiple: true + - name: Download fatJars + uses: actions/download-artifact@v4.1.1 + with: + name: fat-jars + path: build/shadow/ merge-multiple: true - name: Find the version of Node from package.json id: node-version @@ -271,7 +294,6 @@ jobs: maven-central-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} signing-key: ${{ secrets.SIGNING_KEY }} signing-password: ${{ secrets.SIGNING_PASSWORD }} - #Add a step to publish to AUR success: runs-on: ubuntu-22.04 @@ -280,7 +302,7 @@ jobs: - build-website - release - test-deploy - - test-packaging + - test-packages if: >- always() && ( contains(join(needs.*.result, ','), 'failure') diff --git a/alchemist-full/build.gradle.kts b/alchemist-full/build.gradle.kts index ca7e64bc71..d47e020129 100644 --- a/alchemist-full/build.gradle.kts +++ b/alchemist-full/build.gradle.kts @@ -141,7 +141,7 @@ tasks.register("testJpackageOutput") { require(rootProject.name in execFiles || "${rootProject.name}.exe" in execFiles) require(jpackageFull.get().mainJar in appFiles) } - dependsOn(jpackageFull) + mustRunAfter(jpackageFull) finalizedBy(deleteJpackageOutput) } diff --git a/release.config.js b/release.config.js index 73005ff04b..62ac13de41 100644 --- a/release.config.js +++ b/release.config.js @@ -15,7 +15,6 @@ git push --force origin \${nextRelease.version} || exit 6 git -C build/website/ add . || exit 1 git -C build/website/ commit -m "chore: update website to version \${nextRelease.version}" || exit 2 git -C build/website/ push || exit 3 -./gradlew shadowJar --parallel || ./gradlew shadowJar --parallel || exit 4 RELEASE_ON_CENTRAL="./gradlew uploadKotlinOSSRH uploadKotlinMultiplatform uploadJvm uploadJs release --parallel" eval "$RELEASE_ON_CENTRAL" || eval "$RELEASE_ON_CENTRAL" || eval "$RELEASE_ON_CENTRAL" || exit 5 ./gradlew publishKotlinOSSRHPublicationToGithubRepository --continue || true From 2e13a56c3e280df2e8e3ff516fc9e4b5681f22e3 Mon Sep 17 00:00:00 2001 From: Marco Sternini Date: Sun, 28 Jan 2024 16:32:09 +0100 Subject: [PATCH 2/3] fix: farJar upload condition --- .github/workflows/build-and-deploy.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index df07deb692..fc731f3899 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -23,11 +23,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ windows-2022, macos-12] - generateJars: [false] - include: - - os: ubuntu-22.04 - generateJars: true + os: [ windows-2022, macos-12, ubuntu-22.04] runs-on: ${{ matrix.os }} timeout-minutes: 180 concurrency: @@ -70,10 +66,10 @@ jobs: path: build/package/* if-no-files-found: error - name: Generate jars - if: ${{ matrix.generateJars }} + if: ${{ runner.os == 'Linux' }} run: ./gradlew shadowJar - name: Upload FatJars - if: ${{ matrix.generateJars }} + if: ${{ runner.os == 'Linux' }} uses: actions/upload-artifact@v4.3.0 with: name: fat-jars From 2ccc183b3c4d22bc919194755c4de558064cc111 Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Mon, 29 Jan 2024 13:13:05 +0100 Subject: [PATCH 3/3] Update .github/workflows/build-and-deploy.yml --- .github/workflows/build-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index fc731f3899..cc2cdd393e 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -23,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ windows-2022, macos-12, ubuntu-22.04] + os: [ windows-2022, macos-12, ubuntu-22.04 ] runs-on: ${{ matrix.os }} timeout-minutes: 180 concurrency: