Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update codecov with flags for coverage workflow #19

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 22 additions & 62 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:

- run: bundle exec rake coverage:run

- run: sudo apt install tree
- run: tree -a coverage

- uses: actions/upload-artifact@v4
with:
name: "coverage-ruby-${{ matrix.ruby-version }}"
Expand All @@ -48,76 +51,33 @@ jobs:
name: "Report to CodeCov"
needs: [coverage]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"
- "head"
timeout-minutes: 3

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3"
bundler-cache: true

- uses: actions/download-artifact@v4
with:
pattern: coverage-ruby-*
path: coverage-results
merge-multiple: true
pattern: "coverage-ruby-${{ matrix.ruby-version }}*"
path: coverage

- run: bundle exec rake coverage:report
env:
COV_DIR: coverage-results

- name: Populate coverage result path for different ruby
run: |
for dir in coverage-results/ruby-*; do
version=$(basename "$dir")
short_version=$(echo "$version" | cut -d'.' -f1,2 | sed 's/\./-/g')
echo "dir-${short_version}=$dir" >> $GITHUB_ENV
done

- name: Upload coverage to Codecov (ruby 2.7)
uses: codecov/codecov-action@v4
with:
directory: ${{ env.dir-ruby-2-7 }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: ruby-2-7
fail_ci_if_error: true

- name: Upload coverage to Codecov (ruby 3.0)
uses: codecov/codecov-action@v4
with:
directory: ${{ env.dir-ruby-3-0 }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: ruby-3-0
fail_ci_if_error: true

- name: Upload coverage to Codecov (ruby 3.1)
uses: codecov/codecov-action@v4
with:
directory: ${{ env.dir-ruby-3-1 }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: ruby-3-1
fail_ci_if_error: true

- name: Upload coverage to Codecov (ruby 3.2)
uses: codecov/codecov-action@v4
with:
directory: ${{ env.dir-ruby-3-3 }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: ruby-3-2
fail_ci_if_error: true

- name: Upload coverage to Codecov (ruby 3.3)
uses: codecov/codecov-action@v4
with:
directory: ${{ env.dir-ruby-3-3 }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: ruby-3-3
fail_ci_if_error: true
- run: sudo apt install tree
- run: tree -a coverage

- name: Upload coverage to Codecov (ruby 3.4)
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
directory: ${{ env.dir-ruby-3-4 }}
directory: coverage
token: ${{ secrets.CODECOV_TOKEN }}
flags: ruby-3-4
flags: "ruby-${{ matrix.ruby-version }}"
fail_ci_if_error: true