From 6f20c954df0d3b2ccafeca42b330c71678a7d493 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 May 2024 10:13:48 +0300 Subject: [PATCH 1/7] a comwnt --- app/invaders/invader.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/invaders/invader.rb b/app/invaders/invader.rb index 2c33b5d..23963fc 100644 --- a/app/invaders/invader.rb +++ b/app/invaders/invader.rb @@ -1,6 +1,7 @@ class Invader private + # a comment attr_reader :face attr_reader :radar_signal From 5b42af003fae0db68e1231954b4a453cf58c5a1a Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 May 2024 12:13:04 +0300 Subject: [PATCH 2/7] testing --- .github/workflows/coveralls.yml | 24 ++++++++++++++++++++++++ .github/workflows/ruby.yml | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index 4501aa7..e27a4c9 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -8,5 +8,29 @@ jobs: run: runs-on: ubuntu-latest steps: + - name: 'Download artifact' + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "coverager" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverager.zip`, Buffer.from(download.data)); + + - name: 'Unzip artifact' + run: unzip coverager.zip + - name: Coveralls uses: coverallsapp/github-action@v2 diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 4a923e5..ed205ca 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -30,3 +30,26 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests run: bundle exec rake + + - name: Save Coverage report + run: | + mkdir -p ./cc + echo /home/runner/work/space_invaders/space_invaders/coverage/.resultset.json > ./cc/coverage.json + - uses: actions/upload-artifact@v4 + with: + name: coverager + path: cc/ + + - name: 'Comment on PR' + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + let fs = require('fs'); + let issue_number = Number(fs.readFileSync('./pr_number')); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: 'Thank you for the PR!' + }); From 5b33ec8a3166ca4f79d461950386db401466aa76 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 May 2024 12:15:05 +0300 Subject: [PATCH 3/7] testing #2 --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ed205ca..d736df8 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -46,7 +46,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./pr_number')); + let issue_number = Number(fs.readFileSync('./coverage.json')); await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, From 81d9e7a22d38532f532f87bef43e0defda8fb7ac Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 May 2024 12:17:30 +0300 Subject: [PATCH 4/7] testing --- .github/workflows/coveralls.yml | 15 +++++++++++++++ .github/workflows/ruby.yml | 14 -------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index e27a4c9..26a6839 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -34,3 +34,18 @@ jobs: - name: Coveralls uses: coverallsapp/github-action@v2 + + - name: 'Comment on PR' + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + let fs = require('fs'); + let issue_number = Number(fs.readFileSync('./coverage.json')); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: 'Thank you for the PR!' + }); + diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index d736df8..b47d56d 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -39,17 +39,3 @@ jobs: with: name: coverager path: cc/ - - - name: 'Comment on PR' - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./coverage.json')); - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue_number, - body: 'Thank you for the PR!' - }); From 050fdb8643871014458c1358ae564186d0b2df74 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 May 2024 12:23:08 +0300 Subject: [PATCH 5/7] testing --- .github/workflows/use_data.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/use_data.yml b/.github/workflows/use_data.yml index 1507b12..65732c5 100644 --- a/.github/workflows/use_data.yml +++ b/.github/workflows/use_data.yml @@ -45,5 +45,5 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: issue_number, - body: 'Thank you for the PR!' + body: `Thank you for the PR! ${issue_number}` }); \ No newline at end of file From 89a16876eb1246b0f842495c87c799074ddc67c0 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 May 2024 12:28:00 +0300 Subject: [PATCH 6/7] cp file --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index b47d56d..3f677ac 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -34,7 +34,7 @@ jobs: - name: Save Coverage report run: | mkdir -p ./cc - echo /home/runner/work/space_invaders/space_invaders/coverage/.resultset.json > ./cc/coverage.json + cp /home/runner/work/space_invaders/space_invaders/coverage/.resultset.json ./cc/coverage.json - uses: actions/upload-artifact@v4 with: name: coverager From 79359ee7c7fb1052f6f91b23f79807ea5ffbb0cc Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 May 2024 12:32:56 +0300 Subject: [PATCH 7/7] ident --- .github/workflows/coveralls.yml | 74 ++++++++++++++++----------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index 26a6839..e103b98 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -8,44 +8,44 @@ jobs: run: runs-on: ubuntu-latest steps: - - name: 'Download artifact' - uses: actions/github-script@v6 - with: - script: | - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "coverager" - })[0]; - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverager.zip`, Buffer.from(download.data)); + - name: 'Download artifact' + uses: actions/github-script@v6 + with: + script: | + let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "coverager" + })[0]; + let download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + let fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverager.zip`, Buffer.from(download.data)); - - name: 'Unzip artifact' - run: unzip coverager.zip + - name: 'Unzip artifact' + run: unzip coverager.zip - - name: Coveralls - uses: coverallsapp/github-action@v2 + - name: Coveralls + uses: coverallsapp/github-action@v2 - - name: 'Comment on PR' - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./coverage.json')); - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue_number, - body: 'Thank you for the PR!' - }); + - name: 'Comment on PR' + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + let fs = require('fs'); + let issue_number = Number(fs.readFileSync('./coverage.json')); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: 'Thank you for the PR!' + });