Skip to content

Commit

Permalink
fix(service/java-client): add support for partial builds using codeco… (
Browse files Browse the repository at this point in the history
#52)

Signed-off-by: Sven Trieflinger <[email protected]>
  • Loading branch information
strieflin authored Jul 27, 2023
1 parent fbe2610 commit 5a7a591
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/java-client.build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down Expand Up @@ -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
17 changes: 16 additions & 1 deletion .github/workflows/service.build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down Expand Up @@ -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
13 changes: 13 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -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]+/)"
1 change: 0 additions & 1 deletion ephemeral-java-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<skip.tests>false</skip.tests>
<java.version>1.8</java.version>

Expand Down

0 comments on commit 5a7a591

Please sign in to comment.