Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework Pull Request #1

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI
'on':
- push
jobs:
code_checks:
runs-on: ubuntu-20.04
services:
db:
image: mysql:5.7.44
ports:
- 3307:3307
env:
MYSQL_DATABASE: 'homework_assignment_2024_test'
MYSQL_USER: 'rails_user'
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}
MYSQL_ROOT_HOST: '%'
MYSQL_TCP_PORT: 3307
# MYSQL_HOST: localhost
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Show databases for root user
run: mysql --protocol=tcp -h 127.0.0.1 -P 3307 -u root -p${{ secrets.MYSQL_ROOT_PASSWORD }} -e "SHOW DATABASES"
- name: Show databases for rails_user
run: mysql --protocol=tcp -h 127.0.0.1 -P 3307 -u rails_user -p${{ secrets.MYSQL_PASSWORD }} -e "SHOW DATABASES"
- uses: actions/setup-node@v1
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec rake
# - name: Gem cache
# id: cache-bundle
# uses: actions/cache@v1
# with:
# path: vendor/bundle
# key: 'bundle-${{ hashFiles(''**/Gemfile.lock'') }}'
# - name: Bundle install
# env:
# RAILS_ENV: test
# run: |
# gem install bundler
# bundle install --jobs 4 --retry 3 --path vendor/bundle
- name: Install yarn
run: npm install -g yarn
- name: Get yarn cache dir
id: yarn-cache-dir
run: 'echo "::set-output name=dir::$(yarn cache dir)"'
- name: Yarn cache
id: cache-yarn
uses: actions/cache@v1
with:
path: '${{ steps.yarn-cache-dir.outputs.dir }}'
key: 'yarn-${{ hashFiles(''**/yarn.lock'') }}'
- name: Yarn install
run: yarn install
- name: 'Setup DB, Run tests'
env:
RAILS_ENV: test
run: bundle exec rails db:migrate
- name: Audit
env:
RAILS_ENV: test
run: bundle exec rake audit
- name: Rubocop
env:
RAILS_ENV: test
run: bundle exec rubocop
- name: RSpec
env:
RAILS_ENV: test
run: bundle exec rspec
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
Loading
Loading