Skip to content

Commit

Permalink
chore: enable codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiSF committed Jan 24, 2024
1 parent b3b0393 commit da94095
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/callable-get-package-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ jobs:
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Install
if: steps.cache-package-list.outputs.cache-hit != 'true'
# if: steps.cache-package-list.outputs.cache-hit != 'true'
run: yarn
shell: bash
# Need the repo checked out in order to read the file
- name: Dump Package List
if: steps.cache-package-list.outputs.cache-hit != 'true'
# if: steps.cache-package-list.outputs.cache-hit != 'true'
run: |
echo "packages=$(yarn lerna ls | egrep -v "lerna|Done|yarn" | jq -R -s -c 'split("\n")[:-1]')" > package-list.json
echo "packages=$(yarn lerna ll | egrep -v "lerna|Done|yarn" | jq -R -s -c 'split("\n")[:-1] | map({name: split(" ")[0], path: split(" ")[-1]})')" > package-list.json
- name: Get Package List
id: get_package_list
run: |
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/callable-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
get-package-list:
uses: ./.github/workflows/callable-get-package-list.yml
unit_test:
name: Unit Test - ${{ matrix.package }}
name: Unit Test - ${{ matrix.package.name }}
runs-on: ubuntu-latest
needs: get-package-list
strategy:
Expand All @@ -23,5 +23,25 @@ jobs:
- name: Run tests
working-directory: ./amplify-js
env:
TEST_PACKAGE: ${{ matrix.package }}
TEST_PACKAGE: ${{ matrix.package.name }}
run: npx lerna exec --scope $TEST_PACKAGE yarn test
- name: Check coverage report existence
id: check-report
env:
PACKAGE_PATH: ${{ matrix.package.path }}
run: |
if [ -f ./amplify-js/$PACKAGE_PATH/coverage/coverage-final.json ]; then
echo "SHOULD_UPLOAD_REPORT=true" >> $GITHUB_OUTPUT;
fi
- name: Get coverage report flag
if: steps.check-report.outputs.SHOULD_UPLOAD_REPORT == 'true'
env:
PACKAGE_PATH: ${{ matrix.package.path }}
id: split-path
run: echo "REPORT_FLAG=${PACKAGE_PATH##*/}" >> $GITHUB_OUTPUT
- name: Upload coverage report
if: steps.check-report.outputs.SHOULD_UPLOAD_REPORT == 'true'
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
with:
files: ./amplify-js/${{ matrix.package.path }}/coverage/coverage-final.json
flags: ${{ steps.split-path.outputs.REPORT_FLAG }}

0 comments on commit da94095

Please sign in to comment.