ci: GitHub Actions 테스트 워크플로우 추가 #1
This file contains hidden or 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: Test | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| ruby: ['3.0', '3.1', '3.2', '3.3', '3.4'] | |
| experimental: [false] | |
| include: | |
| # Test on Windows with latest stable Ruby | |
| - os: windows-latest | |
| ruby: '3.3' | |
| experimental: true | |
| # Test with Ruby head on Ubuntu | |
| - os: ubuntu-latest | |
| ruby: 'head' | |
| experimental: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true # runs 'bundle install' and caches installed gems | |
| - name: Run tests | |
| run: bundle exec rspec --format documentation | |
| continue-on-error: ${{ matrix.experimental }} | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.4' | |
| bundler-cache: true | |
| - name: Run tests with coverage | |
| run: | | |
| bundle exec rspec --format documentation | |
| - name: Upload coverage reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| if: always() |