This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
DNZ Quarterly Updates #49
Workflow file for this run
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
name: Tests | |
on: pull_request | |
jobs: | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn install | |
- name: prettier | |
run: yarn run prettier --check . | |
erblint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Erblint | |
run: | | |
bundle exec erblint --lint-all | |
rubocop: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Rubocop | |
run: | | |
bundle exec rubocop | |
brakeman: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run the brakeman test | |
run: | | |
gem install brakeman | |
brakeman --run-all-checks | |
bundle-audit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run the bundle audit test | |
run: | | |
gem install bundler-audit | |
bundle audit check --update | |
rspec: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8.0.28 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Verify MySQL connection from host | |
run: | | |
sudo apt-get install -y mysql-client libmysqlclient-dev | |
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -proot -e "SHOW GRANTS FOR 'root'@'localhost'" | |
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -proot mysql | |
- name: Install deps and create DB | |
env: | |
MYSQL_PASSWORD: root | |
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} | |
run: | | |
cp config/application.yml.example config/application.yml | |
gem install bundler --version $(tail -n1 Gemfile.lock) | |
yarn install | |
RAILS_ENV=test bin/rails assets:precompile | |
bin/rails db:prepare | |
- name: Run RSpec unit tests | |
env: | |
MYSQL_PASSWORD: root | |
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
run: | | |
bundle exec rspec spec --fail-fast --format=progress |