-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: CI | ||
'on': | ||
- push | ||
jobs: | ||
code_checks: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: 'ruby:3.2.2' | ||
services: | ||
mysql: | ||
image: 'mysql:5.7' | ||
env: | ||
MYSQL_DATABASE: homework_assignment_2024_test | ||
MYSQL_USER: rails_user | ||
MYSQL_PASSWORD: password | ||
MYSQL_ROOT_PASSWORD: password | ||
MYSQL_TCP_PORT: 3307 | ||
ports: | ||
- '3307:3307' | ||
options: >- | ||
--health-cmd="mysqladmin ping" --health-interval=10s | ||
--health-timeout=5s --health-retries=3 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 20.x | ||
registry-url: 'https://registry.npmjs.org' | ||
- 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 | ||
DB_PORT: '${{ job.services.mysql.ports[3307] }}' | ||
run: | | ||
sudo /etc/init.d/mysql start | ||
bin/rails db:create db:schema:load | ||
- name: Audit | ||
run: bundle exec rake audit | ||
- name: Rubocop | ||
run: bundle exec rubocop | ||
- name: RSpec | ||
run: bundle exec rspec |
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 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