next-l/enju_leaf

View on GitHub
.github/workflows/rubyonrails.yml

Summary

Maintainability
Test Coverage
# This workflow uses actions that are not certified by GitHub.  They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "Ruby on Rails CI"
on: push
jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:13-alpine
        ports:
          - "5432:5432"
        env:
          POSTGRES_DB: enju_leaf_test
          POSTGRES_USER: rails
          POSTGRES_PASSWORD: password
      redis:
        image: redis:6
        ports:
          - "6379:6379"
    env:
      RAILS_ENV: test
      ENJU_LEAF_BIND_ADDRESS: 127.0.0.1
      POSTGRES_USER: rails
      POSTGRES_PASSWORD: password
      CC_TEST_REPORTER_ID: c193cb8ea058a7d62fd62d6d05adaaf95f6bdf882c1039500b30b54494a36e52
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Setup node
        uses: actions/setup-node@v4
        with:
          node-version: 16
      # Add or replace dependency steps here
      - name: Install Ruby and gems
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: Install dependencies
        run: yarn install && sudo apt-get install libvips42
      # Add or replace test runners here
      - name: Start containers
        run: cp .env.test.ci .env.test && cp .env.test .env && cp docker-compose.ci.yml docker-compose.override.yml && docker-compose up -d solr tika
      - 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
      # Add or replace database setup steps here
      - name: Set up database schema
        run: bin/rails db:schema:load
      - name: Generate asset files
        run: bin/rake assets:precompile
      - name: Run tests
        run: |
          ./cc-test-reporter before-build
          bin/rake
          ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?

  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Install Ruby and gems
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      # Add or replace any other lints here
      #- name: Security audit dependencies
      #  run: bin/bundler-audit --update
      #- name: Security audit application code
      #  run: bin/brakeman -q -w2
      #- name: Lint Ruby files
      #  run: bin/rubocop --parallel