Update README.md #547
This file contains 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
# This workflow will download a prebuilt Ruby version, install dependencies, and run linters | |
env: | |
RUBY_VERSION: 3.2 | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_DB: orte_test | |
MYSQL_USER: root | |
MYSQL_PASSWORD: root | |
name: Linters & Rspec | |
on: | |
push: | |
branches: | |
- main | |
- feature* | |
pull_request: | |
branches: | |
- main | |
- feature* | |
jobs: | |
run-lint: | |
name: Rubocop & Brakeman | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler: default | |
bundler-cache: true | |
- name: Install rubocop/brakeman | |
run: | | |
gem install rubocop | |
gem install brakeman | |
- name: Run security checks | |
run: | | |
bundle exec bundle audit --update | |
brakeman -q -w2 | |
- name: Run linters | |
run: | | |
rubocop --parallel | |
run-rspec: | |
name: RSpec | |
needs: run-lint | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_HOST: 127.0.0.1 | |
MYSQL_DB: orte_test | |
MYSQL_USER: root | |
MYSQL_PASSWORD: root | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- "3306:3306" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler: default | |
bundler-cache: true | |
- name: Start & setup MySQL server | |
run: | | |
sudo /etc/init.d/mysql start | |
mysql --version | |
mysql -uroot -h127.0.0.1 -proot -e 'CREATE DATABASE IF NOT EXISTS orte_test;' | |
mysql -uroot -h127.0.0.1 -proot -e "CREATE USER 'orte'@'localhost' IDENTIFIED BY 'orte00';" | |
mysql -uroot -h127.0.0.1 -proot -e "GRANT ALL PRIVILEGES ON orte_test.* TO 'orte'@'localhost';" | |
- name: Run tests | |
env: | |
RAILS_ENV: test | |
COVERAGE: true | |
run: | | |
bin/rails db:setup | |
bundler exec rspec spec | |
- name: Upload coverage results | |
uses: actions/upload-artifact@master | |
if: always() | |
with: | |
name: coverage-report | |
path: coverage |