diff --git a/.github/workflows/java-client.build-and-test.yaml b/.github/workflows/java-client.build-and-test.yaml index e217bd5..c17cc22 100644 --- a/.github/workflows/java-client.build-and-test.yaml +++ b/.github/workflows/java-client.build-and-test.yaml @@ -30,7 +30,7 @@ jobs: filters: | java-client: - '(ephemeral-java-client|.github)/**' - test: + java-client-test: runs-on: ubuntu-22.04 needs: changes if: ${{ needs.changes.outputs.java-client == 'true' }} @@ -61,10 +61,24 @@ jobs: - name: Run Tests run: mvn verify --activate-profiles coverage --batch-mode --no-transfer-progress - name: Collect Jacoco reports - run: echo ::set-output name=reports::$(find . -regex '.*/target/site/jacoco/jacoco.xml' | tr '\n' ',' | sed 's/.$//') + run: echo ::set-output name=reports::$(find . -regex 'target/site/jacoco/jacoco.xml' | tr '\n' ',' | sed 's/.$//') id: jacoco - uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} files: ${{ steps.jacoco.outputs.reports }} + flags: java-client name: codecov + # This is required to allow for setting the test job as required in scenarios + # where the tests are not actually run, e.g., when the helm chart is updated. + java-client-test-status: + runs-on: ubuntu-22.04 + needs: java-client-test + if: '!cancelled()' # Makes the job run regardless whether 'test' succeeds or not but allows for cancellation + steps: + - name: Tests successful + if: ${{ !(contains(needs.java-client-test.result, 'failure')) }} + run: exit 0 + - name: Tests failed + if: ${{ contains(needs.java-client-test.result, 'failure') }} + run: exit 1 diff --git a/.github/workflows/service.build-and-test.yaml b/.github/workflows/service.build-and-test.yaml index 043fed7..4dcbc45 100644 --- a/.github/workflows/service.build-and-test.yaml +++ b/.github/workflows/service.build-and-test.yaml @@ -30,7 +30,7 @@ jobs: filters: | service: - '!((ephemeral-java-client|charts)/**)/**' - test: + service-test: runs-on: ubuntu-22.04 needs: changes if: ${{ needs.changes.outputs.service == 'true' }} @@ -61,4 +61,19 @@ jobs: uses: codecov/codecov-action@v3 with: name: codecov + files: ${{ env.GOPATH }}/src/github.com/${{ github.repository }}/coverage.txt token: ${{ secrets.CODECOV_TOKEN }} + flags: service + # This is required to allow for setting the test job as required in scenarios + # where the tests are not actually run, e.g., when the helm chart is updated. + service-test-status: + runs-on: ubuntu-22.04 + needs: service-test + if: '!cancelled()' # Makes the job run regardless whether 'test' succeeds or not but allows for cancellation + steps: + - name: Tests successful + if: ${{ !(contains(needs.service-test.result, 'failure')) }} + run: exit 0 + - name: Tests failed + if: ${{ contains(needs.service-test.result, 'failure') }} + run: exit 1 diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 0000000..6ec1bcd --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,13 @@ +flag_management: + default_rules: + carryforward: true + individual_flags: + - name: java-client + paths: + - ephemeral-java-client/ + - name: service + paths: + - cmd/ + - pkg/ +fixes: + - "((src/)?github\.com/[^\/\n]+/[^\/\n]+/)" diff --git a/ephemeral-java-client/pom.xml b/ephemeral-java-client/pom.xml index 784bb2c..145f30d 100644 --- a/ephemeral-java-client/pom.xml +++ b/ephemeral-java-client/pom.xml @@ -44,7 +44,6 @@ UTF-8 UTF-8 - false 1.8