diff --git a/.github/actions/build_and_coverage/action.yml b/.github/actions/build_and_coverage/action.yml deleted file mode 100644 index d1fb2610..00000000 --- a/.github/actions/build_and_coverage/action.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: "Build & coverage" -description: "Check the code, build, testing & generate project coverage" - -runs: - using: "composite" - steps: - - # SETUP & CACHE - - uses: coursier/setup-action@v1.3.0 - with: - jvm: adopt:8 - apps: sbt scala scalafmt # https://github.com/coursier/apps - - - uses: coursier/cache-action@v6 - with: - extraKey: "${{ env.SPARK_VERSION }}" - - # CHECK CODE FORMAT - - name: Code Format - id: code_format - if: contains(env.SCOPE, 'test') - run: sbt -DsparkVersion=${{ env.SPARK_VERSION }} scalafmtCheckAll - shell: bash - - # TESTING & COVERAGE - - name: Test & coverage 📋 - id: test_coverage - if: steps.code_format.conclusion == 'success' - run: sbt -DsparkVersion=${{ env.SPARK_VERSION }} coverage +core/test coverageAggregate - shell: bash - - - name: Test Summary - id: test_summary - if: ${{ success() && steps.test_coverage.conclusion == 'success' || failure() && steps.test_coverage.conclusion == 'failure' }} - uses: test-summary/action@v2.0 - with: - paths: "./core/target/test-reports/**/TEST-*.xml" - output: "test-summary.md" - - - name: Add 2 GitHub step summary - if: ${{ (success() || failure()) && steps.test_summary.conclusion == 'success' }} - shell: bash - run: cat test-summary.md >> $GITHUB_STEP_SUMMARY - - - name: Add summary link - id: add_summary_link - if: ${{ (success() || failure()) && steps.test_summary.conclusion == 'success' }} - shell: bash - run: | - img=$(head -1 test-summary.md | perl -pe 's/(<.*?.>).*/$1/') - url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - echo "| ${{ env.SPARK_VERSION }} | [${img}](${url}) |" > test-summary-${{ env.SPARK_VERSION }}.md - cat -e test-summary-${{ env.SPARK_VERSION }}.md - - - name: Upload test summary - if: ${{ github.event_name == 'pull_request' && ((success() || failure()) && steps.add_summary_link.conclusion == 'success') }} - uses: actions/upload-artifact@v3 - with: - name: "test-summary-${{ env.SPARK_VERSION }}.md" - path: "test-summary-${{ env.SPARK_VERSION }}.md" - if-no-files-found: error - retention-days: 1 - - - name: Publish coverage to codecov 📊 - if: contains(env.SCOPE, 'uploadReport') - uses: codecov/codecov-action@v3 - with: - files: ./target/scala-2.12/scoverage-report/scoverage.xml,./target/scala-2.13/scoverage-report/scoverage.xml - fail_ci_if_error: true - verbose: false - flags: 'spark-${{ env.SPARK_VERSION }}.x' - - # CLEAN PROJECT BEFORE CACHE - - name: Cleaning before cache 🚯 - if: ${{ always() }} - uses: ./.github/actions/clean_cache diff --git a/.github/codecov.yml b/.github/codecov.yml index 70114e3a..b6cfe0b0 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -3,7 +3,7 @@ codecov: branch: main notify: wait_for_ci: true - after_n_builds: 4 + after_n_builds: 5 coverage: precision: 2 @@ -37,4 +37,4 @@ comment: layout: "reach,diff,flags,files,footer" behavior: once # once: update, if exists. Otherwise, post new. Skip if deleted. require_changes: false # if true: only post the comment if coverage changes - after_n_builds: 4 + after_n_builds: 5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81d69ba4..34592059 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: name: Check Dependencies steps: - name: PR Dependency Check - uses: gregsdennis/dependencies-action@1.3.2 + uses: gregsdennis/dependencies-action@1.3.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -64,6 +64,7 @@ jobs: uses: ./.github/workflows/wc_build.yml with: matrix_filter: "[]" + secrets: inherit # CHECK MDOC IS OK check_mdoc: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1e0d03c..0b1fff24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,6 +21,7 @@ jobs: uses: ./.github/workflows/wc_build.yml with: matrix_filter: "[?isRelease==`release`]" + secrets: inherit # PUBLISH JARS AT MAVEN CENTRAL matrix_prep: diff --git a/.github/workflows/wc_build.yml b/.github/workflows/wc_build.yml index a33f7af6..a5f21696 100644 --- a/.github/workflows/wc_build.yml +++ b/.github/workflows/wc_build.yml @@ -6,6 +6,9 @@ on: matrix_filter: required: true type: string + secrets: + CODECOV_TOKEN: + required: true jobs: matrix_prep: @@ -29,7 +32,73 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/build_and_coverage - env: - SPARK_VERSION: ${{ matrix.spark }} - SCOPE: ${{ matrix.scope }} + # SETUP & CACHE + - uses: coursier/setup-action@v1.3.0 + with: + jvm: adopt:8 + apps: sbt scala scalafmt # https://github.com/coursier/apps + + - uses: coursier/cache-action@v6 + with: + extraKey: "${{ matrix.spark }}" + + # CHECK CODE FORMAT + - name: Code Format + id: code_format + if: contains(matrix.scope, 'test') + run: sbt -DsparkVersion=${{ matrix.spark }} scalafmtCheckAll + shell: bash + + # TESTING & COVERAGE + - name: Test & coverage 📋 + id: test_coverage + if: steps.code_format.conclusion == 'success' + run: sbt -DsparkVersion=${{ matrix.spark }} coverage +core/test coverageAggregate + shell: bash + + - name: Test Summary + id: test_summary + if: ${{ success() && steps.test_coverage.conclusion == 'success' || failure() && steps.test_coverage.conclusion == 'failure' }} + uses: test-summary/action@v2.0 + with: + paths: "./core/target/test-reports/**/TEST-*.xml" + output: "test-summary.md" + + - name: Add 2 GitHub step summary + if: ${{ (success() || failure()) && steps.test_summary.conclusion == 'success' }} + shell: bash + run: cat test-summary.md >> $GITHUB_STEP_SUMMARY + + - name: Add summary link + id: add_summary_link + if: ${{ (success() || failure()) && steps.test_summary.conclusion == 'success' }} + shell: bash + run: | + img=$(head -1 test-summary.md | perl -pe 's/(<.*?.>).*/$1/') + url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + echo "| ${{ matrix.spark }} | [${img}](${url}) |" > test-summary-${{ matrix.spark }}.md + cat -e test-summary-${{ matrix.spark }}.md + + - name: Upload test summary + if: ${{ github.event_name == 'pull_request' && ((success() || failure()) && steps.add_summary_link.conclusion == 'success') }} + uses: actions/upload-artifact@v3 + with: + name: "test-summary-${{ matrix.spark }}.md" + path: "test-summary-${{ matrix.spark }}.md" + if-no-files-found: error + retention-days: 1 + + - name: Publish coverage to codecov 📊 + if: contains(matrix.scope, 'uploadReport') + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./target/scala-2.12/scoverage-report/scoverage.xml,./target/scala-2.13/scoverage-report/scoverage.xml + fail_ci_if_error: true + verbose: false + flags: 'spark-${{ matrix.spark }}.x' + + # CLEAN PROJECT BEFORE CACHE + - name: Cleaning before cache 🚯 + if: ${{ always() }} + uses: ./.github/actions/clean_cache