From 924f429d37cf3c3e9f1f4355dfba6277f0f37a92 Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 16:32:48 -0800 Subject: [PATCH 01/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/apply_outside_tool.yml diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml new file mode 100644 index 0000000..278d996 --- /dev/null +++ b/.github/workflows/apply_outside_tool.yml @@ -0,0 +1,17 @@ + +name: test_coverage + +on: + pull_request: + # open will be triggered when a pull request is created. + # synchronize will be triggered when a pull request has new commits. + # closed will be triggered when a pull request is closed. + types: [opened, synchronize, closed] + +jobs: + pod-lib-lint-test: + runs-on: macOS-latest + steps: + - uses: actions/checkout@v2 + with: + repository: "firebase/firebase-ios-sdk" From 9a838016513d76d18ebcb63f09a6b47b32960f0b Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:03:20 -0800 Subject: [PATCH 02/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 25 ++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index 278d996..e0b5bad 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -9,9 +9,30 @@ on: types: [opened, synchronize, closed] jobs: - pod-lib-lint-test: + setup: + outputs: + base_commit: ${{ steps.get_base_commit.outputs.base_commit }} runs-on: macOS-latest steps: - - uses: actions/checkout@v2 + - name: Checkout tools + uses: actions/checkout@v2 with: repository: "firebase/firebase-ios-sdk" + path: "tool" + + - name: Checkout + uses: actions/checkout@v2 + with: + path: "main" + + - name: Use Tool + id: get_base_commit + env: + pr_branch: ${{ github.event.pull_request.head.ref }} + run: | + ls + common_commit=$(git merge-base remotes/origin/${pr_branch} remotes/origin/master) + echo "The common commit is ${common_commit}." + # Set base commit and this will be used to compare diffs of coverage to the current commit. + echo "::set-output name=base_commit::${common_commit}" + git diff --name-only $common_commit remotes/origin/${pr_branch} > updated_files.txt From d927aa757bd14bf3232d4844d41b048b0aa89e56 Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:05:40 -0800 Subject: [PATCH 03/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index e0b5bad..c6908df 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -1,5 +1,4 @@ - -name: test_coverage +name: test_coverage_with_external_tool on: pull_request: @@ -25,12 +24,13 @@ jobs: with: path: "main" - - name: Use Tool + - name: Get Diff id: get_base_commit env: pr_branch: ${{ github.event.pull_request.head.ref }} run: | ls + cd main common_commit=$(git merge-base remotes/origin/${pr_branch} remotes/origin/master) echo "The common commit is ${common_commit}." # Set base commit and this will be used to compare diffs of coverage to the current commit. From 6d432abf7d745cf26e5a51c4dcd92a8250ae4798 Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:09:03 -0800 Subject: [PATCH 04/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index c6908df..410e9fa 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -31,7 +31,7 @@ jobs: run: | ls cd main - common_commit=$(git merge-base remotes/origin/${pr_branch} remotes/origin/master) + common_commit=$(git merge-base remotes/origin/${pr_branch} remotes/origin/main) echo "The common commit is ${common_commit}." # Set base commit and this will be used to compare diffs of coverage to the current commit. echo "::set-output name=base_commit::${common_commit}" From 492cdf5d75a1bed861453cf359e9dcf1b160ecaa Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:10:49 -0800 Subject: [PATCH 05/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index 410e9fa..375c8cb 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -31,6 +31,7 @@ jobs: run: | ls cd main + git branch -L common_commit=$(git merge-base remotes/origin/${pr_branch} remotes/origin/main) echo "The common commit is ${common_commit}." # Set base commit and this will be used to compare diffs of coverage to the current commit. From 0d91b813c833a23d51faaeb07caa6328450ea1ee Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:16:34 -0800 Subject: [PATCH 06/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index 375c8cb..e72bb57 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -31,7 +31,7 @@ jobs: run: | ls cd main - git branch -L + git branch -la common_commit=$(git merge-base remotes/origin/${pr_branch} remotes/origin/main) echo "The common commit is ${common_commit}." # Set base commit and this will be used to compare diffs of coverage to the current commit. From f32efb78ff08d0d3aa2801cacc7b8a74e25905d8 Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:19:58 -0800 Subject: [PATCH 07/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index e72bb57..d8d13cc 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -23,6 +23,7 @@ jobs: uses: actions/checkout@v2 with: path: "main" + depth: 0 - name: Get Diff id: get_base_commit From e87f53627f93e0f643d730c4fcf5364a2bcd2b9a Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:26:48 -0800 Subject: [PATCH 08/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index d8d13cc..aef5d68 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v2 with: path: "main" - depth: 0 + fetch-depth: 0 - name: Get Diff id: get_base_commit From 4d9f4eea0f09fa75762509f3997489948e18dd12 Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:39:52 -0800 Subject: [PATCH 09/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index aef5d68..2f3b9ff 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -38,3 +38,4 @@ jobs: # Set base commit and this will be used to compare diffs of coverage to the current commit. echo "::set-output name=base_commit::${common_commit}" git diff --name-only $common_commit remotes/origin/${pr_branch} > updated_files.txt + cat updated_files.txt From 30ef35bc7780dd4e1a947f3b395eeea7d50a7fa3 Mon Sep 17 00:00:00 2001 From: Gran Luo Date: Thu, 4 Mar 2021 17:46:51 -0800 Subject: [PATCH 10/12] Add code coverage workflow. --- .github/workflows/apply_outside_tool.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/apply_outside_tool.yml b/.github/workflows/apply_outside_tool.yml index 2f3b9ff..9d1e321 100644 --- a/.github/workflows/apply_outside_tool.yml +++ b/.github/workflows/apply_outside_tool.yml @@ -18,6 +18,10 @@ jobs: with: repository: "firebase/firebase-ios-sdk" path: "tool" + - name: Build tool + run: | + cd tool/scripts/code_coverage_report/generate_code_coverage_report + swift build - name: Checkout uses: actions/checkout@v2 @@ -39,3 +43,4 @@ jobs: echo "::set-output name=base_commit::${common_commit}" git diff --name-only $common_commit remotes/origin/${pr_branch} > updated_files.txt cat updated_files.txt + ../tool/scripts/code_coverage_report/generate_code_coverage_report/.build/debug/CoverageReportGenerator From e35ac3de3cf8c0f5ec95736cd7566a1f144afe18 Mon Sep 17 00:00:00 2001 From: granluo Date: Mon, 3 May 2021 18:47:14 -0700 Subject: [PATCH 11/12] Test. --- post_coverage/test.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 post_coverage/test.rb diff --git a/post_coverage/test.rb b/post_coverage/test.rb new file mode 100755 index 0000000..d00550d --- /dev/null +++ b/post_coverage/test.rb @@ -0,0 +1,5 @@ +require 'octokit' + +client = Octokit::Client.new(access_token: ENV["INPUT_ACCESS-TOKEN"]) +client.create_check_suite("granluo/issue_generations", "30ef35bc7780dd4e1a947f3b395eeea7d50a7fa3") +print ("asdf") From d209f805e628867bf29c6396c33288d148174fa2 Mon Sep 17 00:00:00 2001 From: granluo Date: Mon, 3 May 2021 23:32:23 -0700 Subject: [PATCH 12/12] Test new pull request. --- post_coverage/test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/post_coverage/test.rb b/post_coverage/test.rb index d00550d..ff62474 100755 --- a/post_coverage/test.rb +++ b/post_coverage/test.rb @@ -1,5 +1,6 @@ require 'octokit' -client = Octokit::Client.new(access_token: ENV["INPUT_ACCESS-TOKEN"]) -client.create_check_suite("granluo/issue_generations", "30ef35bc7780dd4e1a947f3b395eeea7d50a7fa3") +client = Octokit::Client.new(access_token: ENV["INPUT_ACCESS_TOKEN"]) +#client.add_comment(REPO_NAME_WITH_OWNER, last_issue.number, NO_WORKFLOW_RUNNING_INFO) +client.create_pull_request_comment("granluo/issue_generations",98,"testing","e35ac3de3cf8c0f5ec95736cd7566a1f144afe18","post_coverage/test.rb",4, {:side=>"RIGHT", :start_line=> 3, :line=> 5}) print ("asdf")