Last active
April 26, 2022 21:00
-
-
Save beauraF/141cd8a0252bc982494f82507de8d8be to your computer and use it in GitHub Desktop.
Simple CI workflow for Rails that run minitest and brakeman on Github Actions
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] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14.1 | |
ports: ["5432:5432"] | |
env: | |
POSTGRES_USER: runner | |
POSTGRES_PASSWORD: password | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
RAILS_ENV: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1.2 | |
bundler-cache: true | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "lts/*" | |
cache: "yarn" | |
- name: Preparing database | |
run: bin/rails db:prepare | |
- name: Run tests | |
run: bin/rails test:all | |
- name: Run brakeman | |
run: bundle exec brakeman |
good one. I appreciate that!
I think you can delete "set up gems cache" and use ruby/setup-ruby@v1 instead with bundler-cache: true instead
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.3
bundler-cache: true
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thankyou!