From e0569d718f0c839be167728d4bde35cb9e27e0aa Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Thu, 18 Jan 2024 13:10:18 +0100 Subject: [PATCH] build: apply workaround for gradle bug (#210) --- .github/actions/bump-version/action.yml | 54 ------------------------- .github/actions/run-tests/action.yml | 21 ---------- .github/actions/setup-build/action.yml | 12 ------ .github/workflows/checkstyle.yaml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/release-all-java.yml | 2 +- .github/workflows/test.yaml | 4 +- .github/workflows/trigger_snapshot.yml | 2 +- build.gradle.kts | 8 +++- 9 files changed, 13 insertions(+), 94 deletions(-) delete mode 100644 .github/actions/bump-version/action.yml delete mode 100644 .github/actions/run-tests/action.yml delete mode 100644 .github/actions/setup-build/action.yml diff --git a/.github/actions/bump-version/action.yml b/.github/actions/bump-version/action.yml deleted file mode 100644 index 54ea4944..00000000 --- a/.github/actions/bump-version/action.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: "Bump version in gradle.properties" -description: "Increments the patch version of the version found in gradle.properties, appends -SNAPSHOT" -inputs: - target_branch: - default: 'main' - description: "Branch on which the version bump is to be done." - required: false - base_version: - description: "The current version, which is to be bumped to the next snapshot" - required: false - -runs: - using: "composite" - steps: - - uses: actions/checkout@v3 - - name: read version from gradle.properties - shell: bash - run: | - # Prepare git env - git config user.name "eclipse-edc-bot" - git config user.email "edc-bot@eclipse.org" - - # checkout target - git fetch origin - git checkout ${{ inputs.target_branch }} - - # use current version from input - baseVersion=${{ inputs.base_version }} - existingVersion=$(grep "version" gradle.properties | awk -F= '{print $2}') - - # read the major, minor, and patch components, consume -SNAPSHOT - IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<"$baseVersion" - INC=0 - # Compute new snapshot version, do not increment snapshot on non-final releases, e.g. -rc1 - if [ -z $SNAPSHOT ]; then - echo "$baseVersion is a final release version, increase patch for next snapshot" - INC=1 - else - echo "$baseVersion is not a final release version (contains \"$SNAPSHOT\"), will not increase patch" - fi - - # construct the new version - newVersion="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+$INC))"-SNAPSHOT - - # replace every occurrence of =$baseVersion with =$newVersion - grep -rlz "$existingVersion" . --exclude=\*.{sh,bin} | xargs sed -i "s/$existingVersion/$newVersion/g" - - echo "Bumped the version from $baseVersion to $newVersion" - - # Commit and push to the desired branch, defaults to 'main' - git add . - git commit --message "Bump version from $baseVersion to $newVersion [skip ci]" - - git push origin ${{ inputs.target_branch }} diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml deleted file mode 100644 index 9a4ef273..00000000 --- a/.github/actions/run-tests/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "Run tests" -description: "Run tests and archive test results for subsequent publication" -inputs: - command: - required: true - description: "The shell command to run tests" -runs: - using: "composite" - steps: - - name: Run Tests - shell: bash - run: ${{ inputs.command }} - - - name: Upload Test Results - uses: actions/upload-artifact@v2 - if: always() - with: - name: Test Results ${{ github.job }} - path: | - **/test-results/**/*.xml - **/build/reports/jacoco/test/jacocoTestReport.xml diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml deleted file mode 100644 index 8dd21c57..00000000 --- a/.github/actions/setup-build/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: "Setup Gradle" -description: "Setup Gradle" -runs: - using: "composite" - steps: - - uses: actions/setup-java@v2 - with: - java-version: '17' - distribution: 'temurin' - - - name: Setup Gradle cache - uses: gradle/gradle-build-action@v2 diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml index 78f4cc38..99ac61dd 100644 --- a/.github/workflows/checkstyle.yaml +++ b/.github/workflows/checkstyle.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-build + - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Run Checkstyle run: ./gradlew checkstyleMain checkstyleTest diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index fc21a4e9..ac502221 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -29,7 +29,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-build + - uses: eclipse-edc/.github/.github/actions/setup-build@main # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/release-all-java.yml b/.github/workflows/release-all-java.yml index 817016e0..576dd2a4 100644 --- a/.github/workflows/release-all-java.yml +++ b/.github/workflows/release-all-java.yml @@ -69,7 +69,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/bump-version + - uses: eclipse-edc/.github/.github/actions/bump-version@main with: target_branch: "main" base_version: ${{ needs.Prepare-Release.outputs.metamodel-version }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 91802c48..c557ee6c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,10 +20,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-build + - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Run unit tests - uses: ./.github/actions/run-tests + uses: eclipse-edc/.github/.github/actions/run-tests@main with: command: ./gradlew test diff --git a/.github/workflows/trigger_snapshot.yml b/.github/workflows/trigger_snapshot.yml index ddf50231..e204f933 100644 --- a/.github/workflows/trigger_snapshot.yml +++ b/.github/workflows/trigger_snapshot.yml @@ -4,10 +4,10 @@ on: push: branches: - main + workflow_dispatch: jobs: Publish-Snapshot: # This workflow will abort if the required secrets don't exist uses: eclipse-edc/.github/.github/workflows/publish-snapshot.yml@main secrets: inherit - diff --git a/build.gradle.kts b/build.gradle.kts index bc61e179..d231d9ee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ allprojects { // for all gradle plugins: pluginManager.withPlugin("java-gradle-plugin") { - apply(plugin = "com.gradle.plugin-publish") + apply(plugin = libs.plugins.publish.get().pluginId) } configure { @@ -57,4 +57,10 @@ allprojects { from("${rootProject.projectDir.path}/LICENSE") } } + + // FIXME - workaround for https://github.com/gradle/gradle/issues/26091 + val signingTasks = tasks.withType() + tasks.withType().configureEach { + mustRunAfter(signingTasks) + } }