(fix) handle case if examples are included above the working directory #277
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lint-and-specs | |
on: | |
push: | |
branches: [ 'main' ] | |
pull_request: | |
concurrency: | |
group: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}-lint-and-specs | |
cancel-in-progress: true | |
jobs: | |
main: | |
name: ruby-${{ matrix.ruby }}-lint-and-specs | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby: [ '2.5', '2.6', '2.7', '3.0' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Setup Code Climate test-reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build | |
- name: Install Dependencies | |
run: bundle install --jobs 3 --retry 3 | |
- name: Run Tests | |
run: bundle exec rake | |
- name: Format Coverage Report | |
env: | |
GIT_BRANCH: ${{ github.event_name == 'pull_request' && github.head_ref || 'main' }} | |
GIT_COMMIT_SHA: ${{ github.sha }} | |
run: | | |
mkdir -p coverage-artifacts | |
./cc-test-reporter format-coverage coverage/coverage.json --input-type simplecov --output coverage-artifacts/ruby-${{ matrix.ruby }}-coverage.json | |
- name: Save Coverage Report | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ruby-${{ matrix.ruby }}-coverage.json | |
path: coverage-artifacts/ruby-${{ matrix.ruby }}-coverage.json | |
retention-days: 1 | |
coverage: | |
needs: [ 'main' ] | |
name: coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Code Climate test-reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build | |
- name: Download Coverage Reports | |
uses: actions/download-artifact@v2 | |
with: | |
path: coverage-artifacts-temp | |
- name: Finalize Artifacts | |
run: | | |
mkdir -p coverage-artifacts | |
find coverage-artifacts-temp -mindepth 2 -type f -exec mv -i '{}' coverage-artifacts ';' | |
- name: Upload Coverage | |
env: | |
GIT_BRANCH: ${{ github.event_name == 'pull_request' && github.head_ref || 'main' }} | |
GIT_COMMIT_SHA: ${{ github.sha }} | |
CC_TEST_REPORTER_ID: "5499f6009ecc1c84cd90aac7409351a1439946922f9405d43b81b1564afd21ed" | |
run: | | |
./cc-test-reporter sum-coverage coverage-artifacts/ruby-*-coverage.json --parts 4 --output coverage-artifacts/coverage.json | |
./cc-test-reporter upload-coverage --input coverage-artifacts/coverage.json |