Skip to content

Commit

Permalink
Continuous integration with Github actions (#59)
Browse files Browse the repository at this point in the history
Runs on any _push_ or _pull request_. Consists of two jobs: `test` and
`lint`

### Test

-  Runs the test suite (including system tests)
-  Publishes the results to Code Climate

### Lint

- Runs bundler-audit
- Runs brakeman
- Runs bundler-leak
- Runs standard
- Runs rubycritic
  • Loading branch information
cmason committed Aug 17, 2023
1 parent 7f46e32 commit a4e3464
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 22 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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: "Continuous Integration"
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@v3
# Add or replace dependency steps here
- name: Install Ruby and gems
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
bundler-cache: true
ruby-version: 3.2.2
# Add or replace database setup steps here
- name: Set up database schema
run: bin/rails db:prepare
# Add or replace test runners here
- name: Run test suite & publish results
uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageCommand: bin/rails test:all
coverageLocations: ${{github.workspace}}/coverage/coverage.json:simplecov
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
with:
bundler-cache: true
ruby-version: 3.2.2
# Add or replace any other lints here
- name: Run Bundler-Audit - Security audit dependencies
run: bin/rails bundle:audit
- name: Run Brakeman - Security audit application code
run: bin/rails brakeman
- name: Run Bundler-Leak - Check for memory leaks in dependencies
run: bin/rails bundle:leak
- name: Run Standard - Lint Ruby files
run: bin/rails standard
- name: Run Rubycritic - Static analysis
run: bin/rails rubycritic
6 changes: 5 additions & 1 deletion .rubycritic.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
minimum_score: 9
minimum_score: 90
no_browser: true
formats:
- console
- html
paths:
- "app/"
- "lib/"
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ GEM
nio4r (2.5.9)
nokogiri (1.15.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.3-x86_64-linux)
racc (~> 1.4)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
Expand Down Expand Up @@ -316,6 +318,7 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.6.3-x86_64-darwin)
sqlite3 (1.6.3-x86_64-linux)
stackprof (0.2.25)
standard (1.30.1)
language_server-protocol (~> 3.17.0.2)
Expand Down Expand Up @@ -366,6 +369,7 @@ GEM

PLATFORMS
x86_64-darwin-20
x86_64-linux

DEPENDENCIES
annotate
Expand Down
27 changes: 7 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
# README
# Letterkenny

This README would normally document whatever steps are necessary to get the
application up and running.
[![Continuous Integration](https://github.com/cmason/letterkenny/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cmason/letterkenny/actions/workflows/ci.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/2f2927df55e93b1540a4/maintainability)](https://codeclimate.com/github/cmason/letterkenny/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/2f2927df55e93b1540a4/test_coverage)](https://codeclimate.com/github/cmason/letterkenny/test_coverage)

Things you may want to cover:
Letterkenny consists of hicks, skids, hockey players, and Christians. These are their quotes.

* Ruby version
----

* System dependencies

* Configuration

* Database creation

* Database initialization

* How to run the test suite

* Services (job queues, cache servers, search engines, etc.)

* Deployment instructions

* ...
TODO: Add content
2 changes: 1 addition & 1 deletion lib/tasks/ci.rake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end

desc "Scans application for vulnerabilities"
task :brakeman do
sh "bundle exec brakeman -q --no-pager"
sh "bundle exec brakeman -q --no-pager --ensure-latest"
end

desc "Run static analysis code quality report"
Expand Down

0 comments on commit a4e3464

Please sign in to comment.