From 156090fbd315262dc663f30f51e247ce263a99e7 Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Thu, 22 Aug 2024 09:34:54 +0200 Subject: [PATCH] ci: launch test workflow also on release and bugfix branches --- .github/workflows/codeql-analysis.yml | 50 ----------------- .github/workflows/dependency-check.yml | 14 ----- .github/workflows/prepare-release.yml | 16 ++++++ .github/workflows/release-tech-hc.yml | 75 ------------------------- .github/workflows/release.yml | 10 ++++ .github/workflows/verify.yaml | 78 +++++--------------------- 6 files changed, 39 insertions(+), 204 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/dependency-check.yml create mode 100644 .github/workflows/prepare-release.yml delete mode 100644 .github/workflows/release-tech-hc.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index da54a6b..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "CodeQL" - -on: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - branches: [ main ] - paths-ignore: - - '**.md' - - 'docs/**' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'java' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - uses: actions/checkout@v4 - - uses: eclipse-edc/.github/.github/actions/setup-build@main - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - queries: +security-and-quality - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Compiles production Java source (without tests) - - name: Build - run: ./gradlew compileJava --no-daemon - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml deleted file mode 100644 index e56a6da..0000000 --- a/.github/workflows/dependency-check.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: 'Dependency Review' -on: - push: - branches: - - main - pull_request: - -permissions: - contents: read - -jobs: - check: - uses: eclipse-edc/.github/.github/workflows/dependency-check.yml@main - secrets: inherit diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..5e11c52 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,16 @@ +name: Prepare Release + +on: + workflow_dispatch: + inputs: + version: + description: the version to be released. If it ends with '.0' a proper release is created, bugfix otherwise + required: true + type: string + +jobs: + Prepare-Release: + uses: eclipse-edc/.github/.github/workflows/technology-prepare-release.yml@main + secrets: inherit + with: + version: ${{ inputs.version }} diff --git a/.github/workflows/release-tech-hc.yml b/.github/workflows/release-tech-hc.yml deleted file mode 100644 index 0d1a998..0000000 --- a/.github/workflows/release-tech-hc.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Create Release of Technology-HuaweiCloud -on: - workflow_dispatch: - inputs: - edc_version: - description: 'Version string that is used for publishing (e.g. "1.0.0", NOT "v1.0.0"). Appending -SNAPSHOT will create a snapshot release.' - required: true - type: string - - -env: - EDC_VERSION: ${{ github.event.inputs.edc_version || inputs.edc_version }} - -jobs: - Prepare-Release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - # create tag on the current branch using GitHub's own API - - name: Create tag on current branch (main) - uses: actions/github-script@v6 - with: - script: | - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'refs/tags/v${{ env.EDC_VERSION }}', - sha: context.sha - }) - - # create merge commit main -> releases encoding the version in the commit message - - name: Merge main -> releases - uses: everlytic/branch-merge@1.1.5 - with: - github_token: ${{ github.token }} - source_ref: ${{ github.ref }} - target_branch: 'releases' - commit_message_template: 'Merge commit for release of version v${{ env.EDC_VERSION }}' - - outputs: - edc-version: ${{ env.EDC_VERSION }} - - Github-Release: - # cannot use the workflow-level env yet as it does not yet exist, must take output from previous job - if: ${{ !endsWith( needs.Prepare-Release.outputs.edc-version, '-SNAPSHOT') }} - needs: - - Prepare-Release - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - ref: main - - name: Create GitHub Release - uses: ncipollo/release-action@v1 - with: - generateReleaseNotes: true - tag: "v${{ env.EDC_VERSION }}" - token: ${{ secrets.GITHUB_TOKEN }} - removeArtifacts: true - - Bump-Version: - name: 'Update release version' - # cannot use the workflow-level env yet as it does not yet exist, must take output from previous job - if: ${{ !endsWith( needs.Prepare-Release.outputs.edc-version, '-SNAPSHOT') }} - needs: [ Prepare-Release, Github-Release ] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: eclipse-edc/.github/.github/actions/bump-version@main - with: - target_branch: "main" - base_version: ${{ needs.Prepare-Release.outputs.edc-version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..66f17fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,10 @@ +name: Release + +on: + workflow_dispatch: + + +jobs: + Release: + uses: eclipse-edc/.github/.github/workflows/technology-release.yml@main + secrets: inherit diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index a202b47..b883f90 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: pull_request: - branches: [ main ] + branches: [ main, release/*, bugfix/* ] paths-ignore: - '**.md' - 'docs/**' @@ -17,43 +17,38 @@ concurrency: jobs: Checkstyle: - permissions: - id-token: write - checks: write - pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: eclipse-edc/.github/.github/actions/setup-build@main - - name: Run Checkstyle run: ./gradlew checkstyleMain checkstyleTest + CodeQL: + uses: eclipse-edc/.github/.github/workflows/codeql-analysis.yml@main + secrets: inherit + + Dependency-Check: + uses: eclipse-edc/.github/.github/workflows/dependency-check.yml@main + secrets: inherit + Unit-Tests: runs-on: ubuntu-latest - env: - JACOCO: true steps: - uses: actions/checkout@v4 - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Run unit tests - uses: eclipse-edc/.github/.github/actions/run-tests@main - with: - command: ./gradlew test jacocoTestReport + run: ./gradlew test Component-Tests: - env: - JACOCO: true runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Component Tests - uses: eclipse-edc/.github/.github/actions/run-tests@main - with: - command: ./gradlew jacocoTestReport -DincludeTags="ComponentTest" + run: ./gradlew -DincludeTags="ComponentTest" End-To-End-Tests: runs-on: ubuntu-latest @@ -62,60 +57,13 @@ jobs: - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: End to End Integration Tests - uses: eclipse-edc/.github/.github/actions/run-tests@main - with: - command: ./gradlew test -DincludeTags="EndToEndTest" + run: ./gradlew test -DincludeTags="EndToEndTest" API-Tests: - env: - JACOCO: true runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Component Tests - uses: eclipse-edc/.github/.github/actions/run-tests@main - with: - command: ./gradlew test jacocoTestReport -DincludeTags="ApiTest" - - - Upload-Test-Report: - needs: - - Unit-Tests - - End-To-End-Tests - - Component-Tests - - permissions: - checks: write - pull-requests: write - - runs-on: ubuntu-latest - if: always() - steps: - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - junit_files: "**/test-results/**/*.xml" - - Upload-Coverage-Report-To-Codecov: - needs: - - Unit-Tests - - Component-Tests - - API-Tests - runs-on: ubuntu-latest - if: always() - steps: - # Sources are needed for Codecov report - - uses: actions/checkout@v4 - - name: Download Artifacts - uses: actions/download-artifact@v3 - with: - path: artifacts - - name: CodeCov - uses: codecov/codecov-action@v3 + run: ./gradlew test -DincludeTags="ApiTest"