Skip to content

Commit

Permalink
Update codecov to check during PR (#995)
Browse files Browse the repository at this point in the history
* Update codecov to check during PR

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Nov 19, 2024
1 parent 9412884 commit efa334c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 39 deletions.
80 changes: 50 additions & 30 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ on:
branches:
- "*"
- "feature/**"
pull_request:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- "*"
- "feature/**"
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand All @@ -33,16 +32,24 @@ jobs:
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root

options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Checkout neural-search
uses: actions/checkout@v1
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}

- uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'schedule'

- uses: actions/checkout@v4
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Run build
Expand All @@ -51,7 +58,8 @@ jobs:
su `id -un 1000` -c "./gradlew check"
- name: Upload Coverage Report
uses: codecov/codecov-action@v3
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -65,23 +73,24 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout neural-search
uses: actions/checkout@v1
- uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'schedule'

- uses: actions/checkout@v4
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Run build
run: |
./gradlew check
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}

Precommit-neural-search-linux:
needs: Get-CI-Image-Tag
strategy:
Expand All @@ -96,15 +105,24 @@ jobs:
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Checkout neural-search
uses: actions/checkout@v1
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}

- uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'schedule'

- uses: actions/checkout@v4
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Run build
Expand All @@ -113,7 +131,8 @@ jobs:
su `id -un 1000` -c "./gradlew precommit --parallel"
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -127,19 +146,20 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout neural-search
uses: actions/checkout@v1
- uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'schedule'

- uses: actions/checkout@v4
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}

- name: Run build
run: |
./gradlew precommit --parallel
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
13 changes: 4 additions & 9 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
---
coverage:
# displays different colors depending on below, between, or above the range
range: 50..90
precision: 2
round: down
range: '70...90'
status:
project:
enabled: yes
default:
target: auto
# allows 5% coverage reduction without failing
threshold: 5%
patch: yes
changes: yes

# disable comments in PRs
comment: yes

0 comments on commit efa334c

Please sign in to comment.