Merge develop for v0.2.0 release #6
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: CI | |
| on: | |
| push: | |
| branches: [master, main, develop, release/**] | |
| pull_request: | |
| branches: [master, main, develop] | |
| permissions: | |
| actions: write | |
| contents: read | |
| id-token: write | |
| packages: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby-version: ["2.7", "3.1", "3.2", "3.3", "3.4"] | |
| gemfile: | |
| - gemfiles/activerecord-6.0.Gemfile | |
| - gemfiles/activerecord-6.1.Gemfile | |
| - gemfiles/activerecord-7.0.Gemfile | |
| - gemfiles/activerecord-7.1.Gemfile | |
| - gemfiles/activerecord-7.2.Gemfile | |
| - gemfiles/activerecord-8.0.Gemfile | |
| exclude: | |
| # AR 7.2 requires Ruby >= 3.1 | |
| - ruby-version: "2.7" | |
| gemfile: gemfiles/activerecord-7.2.Gemfile | |
| # AR 8.0 requires Ruby >= 3.2 | |
| - ruby-version: "2.7" | |
| gemfile: gemfiles/activerecord-8.0.Gemfile | |
| - ruby-version: "3.1" | |
| gemfile: gemfiles/activerecord-8.0.Gemfile | |
| include: | |
| # Rails 5.x only works on Ruby 2.7 | |
| - ruby-version: "2.7" | |
| gemfile: gemfiles/activerecord-5.0.Gemfile | |
| - ruby-version: "2.7" | |
| gemfile: gemfiles/activerecord-5.1.Gemfile | |
| - ruby-version: "2.7" | |
| gemfile: gemfiles/activerecord-5.2.Gemfile | |
| env: | |
| BUNDLE_GEMFILE: ${{ matrix.gemfile }} | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/quick_count_test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby ${{ matrix.ruby-version }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| bundler-cache: true | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y postgresql-client libpq-dev | |
| - name: Setup database | |
| run: | | |
| createdb -h localhost -U postgres quick_count_test | |
| env: | |
| PGPASSWORD: postgres | |
| - name: Run tests with coverage | |
| run: bundle exec rspec | |
| env: | |
| COVERAGE: true | |
| - name: Upload coverage artifact (Ruby 3.4, ActiveRecord 8.0 only) | |
| if: matrix.ruby-version == '3.4' && matrix.gemfile == 'gemfiles/activerecord-8.0.Gemfile' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| retention-days: 1 | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download coverage artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| continue-on-error: true | |
| - name: Upload coverage to Qlty | |
| uses: qltysh/qlty-action/coverage@v1 | |
| continue-on-error: true | |
| env: | |
| QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }} | |
| with: | |
| oidc: true | |
| files: coverage/coverage.json | |
| - name: Run Qlty code quality checks | |
| run: | | |
| curl -sSfL https://qlty.sh | sh | |
| echo "$HOME/.qlty/bin" >> $GITHUB_PATH | |
| ~/.qlty/bin/qlty check || true | |
| continue-on-error: true | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| - name: Run bundle audit | |
| run: | | |
| gem install bundler-audit | |
| bundle audit --update || true | |
| continue-on-error: true |