excid3/beginnerbounties.com

Add GitHub Actions CI

Closed this issue · 3 comments

We should run standardrb and the Rails tests on GitHub Actions for pull requests and on the main branch.

We need to add the standardrb gem and the following config to .github/workflows/ci.yml

name: Tests

on:
  pull_request:
    branches:
      - '*'
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:latest
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: password
        ports: ['5432:5432']

    steps:
      - uses: actions/checkout@v3

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler: default
          bundler-cache: true

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: '18'
          cache: yarn

      - name: Install dependencies
        run: |
          sudo apt-get install -y -qq libvips
          yarn install --frozen-lockfile

      - name: Standardrb Check
        run: bundle exec standardrb

      - name: Run tests
        env:
          DATABASE_URL: postgres://postgres:password@localhost:5432/test
          RAILS_ENV: test
          PG_USER: postgres
        run: |
          bin/rails test:prepare
          bin/rails db:test:prepare
          bin/rails test
          bin/rails test:system

can fix, keen to explore this platform and see how it works for my students.

I am interested in this! 👀

Feel free FMPOV ^ go for it.