From 659b53ed3c94ff1338450b4e81e5b733f60232f3 Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Mon, 27 Nov 2023 11:00:14 -0800 Subject: [PATCH 01/10] add codecov report workflow --- .github/workflows/codecov.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..92836cbdb --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,14 @@ +name: codecov +on: + pull_request: + +jobs: + run-codecov: + runs-on: ubuntu-latest + steps: + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + From 49d90fe5748e255ea1ad2e6b865a3630e9663c62 Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 11:25:36 -0800 Subject: [PATCH 02/10] Change token method --- .github/workflows/codecov.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 92836cbdb..c6126ae45 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -8,7 +8,8 @@ jobs: steps: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + flags: unit + fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} From 1a6a721ac7c93d3911bede9efddf33126d269a2a Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 11:30:15 -0800 Subject: [PATCH 03/10] add file path --- .github/workflows/codecov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index c6126ae45..b9592a9d9 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -9,6 +9,7 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: + files: ./coverage.json flags: unit fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} From 4e29f79baf766ac21b2d7a489c3e24139997e550 Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 11:52:04 -0800 Subject: [PATCH 04/10] Collect jest coverage and add it in gitignore --- .gitignore | 1 + jest.config.js | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 6801f890d..bdf59df4f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ app-settings.json www/dist/ config.xml package.json +coverage/ diff --git a/jest.config.js b/jest.config.js index 21184bdd7..a67623088 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,4 +16,5 @@ module.exports = { ], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleDirectories: ["node_modules", "src"], + collectCoverage: true, }; From 4f6ec43bb3a47037275a75273da2f3ac00ca62fc Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 11:52:24 -0800 Subject: [PATCH 05/10] Check if coverage file is in the target directory --- .github/workflows/codecov.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index b9592a9d9..4076a045a 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -6,11 +6,16 @@ jobs: run-codecov: runs-on: ubuntu-latest steps: - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - with: - files: ./coverage.json - flags: unit - fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} + - name : Check coverage file directory + - run: | + cd coverage + ls -la ./ + + # - name: Upload coverage reports to Codecov + # uses: codecov/codecov-action@v3 + # with: + # files: coverage/coverage.json + # flags: unit + # fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} From f497f4de85cc7f428fef3e2f59bcc016c24f9c72 Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 11:59:51 -0800 Subject: [PATCH 06/10] Execute codecov report after jest test --- .github/workflows/codecov.yml | 21 --------------------- .github/workflows/serve-install.yml | 11 +++++++++++ 2 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index 4076a045a..000000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: codecov -on: - pull_request: - -jobs: - run-codecov: - runs-on: ubuntu-latest - steps: - - name : Check coverage file directory - - run: | - cd coverage - ls -la ./ - - # - name: Upload coverage reports to Codecov - # uses: codecov/codecov-action@v3 - # with: - # files: coverage/coverage.json - # flags: unit - # fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} - - diff --git a/.github/workflows/serve-install.yml b/.github/workflows/serve-install.yml index c78ce1f86..6eed87594 100644 --- a/.github/workflows/serve-install.yml +++ b/.github/workflows/serve-install.yml @@ -64,6 +64,17 @@ jobs: run: | npx jest + - name : Check coverage file directory + run: | + ls -la ./ + + # - name: Upload coverage reports to Codecov + # uses: codecov/codecov-action@v3 + # with: + # files: coverage/coverage-final.json + # flags: unit + # fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} + # TODO: figure out how to check that a server started correctly # - name: Try starting it # run: npx run serve From 84d4e3899bf2da7e8dd282fb63af632153a9877b Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 12:12:46 -0800 Subject: [PATCH 07/10] Upload coverage reports to Codecov --- .github/workflows/serve-install.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/serve-install.yml b/.github/workflows/serve-install.yml index 6eed87594..f7902b2ea 100644 --- a/.github/workflows/serve-install.yml +++ b/.github/workflows/serve-install.yml @@ -64,16 +64,12 @@ jobs: run: | npx jest - - name : Check coverage file directory - run: | - ls -la ./ - - # - name: Upload coverage reports to Codecov - # uses: codecov/codecov-action@v3 - # with: - # files: coverage/coverage-final.json - # flags: unit - # fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + files: ./coverage/coverage-final.json + flags: unit + fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} # TODO: figure out how to check that a server started correctly # - name: Try starting it From d2a335c794ed967c95b60792684ddc54f9df435e Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 12:41:22 -0800 Subject: [PATCH 08/10] Add codecov config file --- codecov.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..125b560ef --- /dev/null +++ b/codecov.yml @@ -0,0 +1,8 @@ +comment: + layout: " diff, flags, files" + behavior: default + require_changes: false + require_base: false + require_head: true + hide_project_coverage: false + \ No newline at end of file From 7a94e22a0aa041075d90e2be24a0b1fb00d935b5 Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 13:05:18 -0800 Subject: [PATCH 09/10] Add token in workflow --- .github/workflows/serve-install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/serve-install.yml b/.github/workflows/serve-install.yml index f7902b2ea..71f950189 100644 --- a/.github/workflows/serve-install.yml +++ b/.github/workflows/serve-install.yml @@ -67,6 +67,7 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: + token: ${{secrets.CODECOV_TOKEN}} files: ./coverage/coverage-final.json flags: unit fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }} From 7121ec6d8d9db4ad1fd4c2e177a1a111e6bead83 Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 28 Nov 2023 13:19:26 -0800 Subject: [PATCH 10/10] rollback to previous commit --- .github/workflows/serve-install.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/serve-install.yml b/.github/workflows/serve-install.yml index 71f950189..f7902b2ea 100644 --- a/.github/workflows/serve-install.yml +++ b/.github/workflows/serve-install.yml @@ -67,7 +67,6 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: - token: ${{secrets.CODECOV_TOKEN}} files: ./coverage/coverage-final.json flags: unit fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }}