Episodes

Resources

Download Source Code

Summary

.github/workflows/main.yml
name: CI

on:
  push:
    branches: [ master, develop ]
  pull_request:
    branches: [ master, develop ]

jobs:
  test:
    # services:
    #   db:
    #     image: postgres:11
    #     ports: ['5432:5432']
    runs-on: ubuntu-latest

    steps:
      - uses: actions/[email protected]
      - name: Setup Ruby
        uses: ruby/[email protected]
        with:
          ruby-version: 2.7.1

      - uses: Borales/[email protected]
        with:
          cmd: install

      - name: Install Dependencies
        run: |
          # sudo apt install -yqq libpq-dev
          gem install bundler

      - name: Install Gems
        run: |
          bundle install

      - name: Prepare Database
        run: |
          bundle exec rails db:prepare

      - name: Run Tests
        # env:
        #   DATABASE_URL: postgres://postgres:@localhost:5432/databasename
        #   RAILS_MASTER_KEY: ${{secrets.RAILS_MASTER_KEY}}
        run: |
          bundle exec rails test

      - name: Create Coverage Artifact
        uses: actions/[email protected]
        with:
          name: code-coverage
          path: coverage/

  security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]

      - name: Setup Ruby
        uses: ruby/[email protected]
        with:
          ruby-version: 2.7.1

      - name: Install Brakeman
        run: |
          gem install brakeman

      - name: Run Brakeman
        run: |
          brakeman -f json > tmp/brakeman.json || exit 0

      - name: Brakeman Report
        uses: devmasx/[email protected]
        env:
          REPORT_PATH: tmp/brakeman.json
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}