diff --git a/.github/actions/upload-test-coverage/action.yml b/.github/actions/upload-test-coverage/action.yml new file mode 100644 index 0000000..3b41696 --- /dev/null +++ b/.github/actions/upload-test-coverage/action.yml @@ -0,0 +1,21 @@ +name: "Upload test coverage file" +description: "Upload test coverage file to the desired location" +outputs: + coverage-value: + description: "coverage value" + value: ${{ steps.coverage-value-getter.outputs.coverage-value }} +runs: + using: "composite" + steps: + - name: "Archive code coverage results" + uses: actions/upload-artifact@v3 + with: + name: code-coverage-report + path: coverage + + - name: "Get coverage value" + id: coverage-value-getter + run: | + coverage_value=`cat ./coverage/.last_run.json | jq -r .result.line` + echo "coverage-value=$coverage_value" >> "$GITHUB_OUTPUT" + shell: bash diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e6abda..668c378 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu, macos] - ruby: [2.6, 2.7] + ruby: [2.7] runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v2 @@ -30,12 +30,13 @@ jobs: run: bundle exec rubocop - name: Run RSpec run: bundle exec rspec - # https://docs.github.com/ja/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts - - name: Archive code coverage results - uses: actions/upload-artifact@v2 - with: - name: code-coverage-report - path: coverage + - name: Upload test coverage + id: upload-test-coverage + uses: ./.github/actions/upload-test-coverage + - name: Display test coverage in summary + run: | + coverage_value=${{ steps.upload-test-coverage.outputs.coverage-value }} + echo "# Coverage report: $coverage_value%" >> $GITHUB_STEP_SUMMARY # https://github.com/marketplace/actions/action-slack - name: Github Actions notify to Slack uses: 8398a7/action-slack@v3 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..a4023dc --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 2.7.5 diff --git a/Gemfile.lock b/Gemfile.lock index 6e9de2a..801e800 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GEM awesome_print (1.9.2) byebug (11.1.3) coderay (1.1.3) - connection_pool (2.3.0) + connection_pool (2.4.0) diff-lcs (1.5.0) docile (1.4.0) domain_name (0.5.20190701) @@ -29,12 +29,12 @@ GEM method_source (0.9.2) mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mini_portile2 (2.8.0) + mime-types-data (3.2023.0218.1) + mini_portile2 (2.8.1) net-http-digest_auth (1.4.1) net-http-persistent (4.0.1) connection_pool (~> 2.2) - nokogiri (1.13.8) + nokogiri (1.14.2) mini_portile2 (~> 2.8.0) racc (~> 1.4) parallel (1.22.1) @@ -49,11 +49,11 @@ GEM pry-doc (1.3.0) pry (~> 0.11) yard (~> 0.9.11) - public_suffix (5.0.0) - qiita_trend (0.5.2) + public_suffix (5.0.1) + qiita_trend (0.5.4) mechanize (~> 2.7) nokogiri (~> 1.11) - racc (1.6.0) + racc (1.6.2) rainbow (3.1.1) regexp_parser (2.6.0) rexml (3.2.5)