Prepare ai code review
All checks were successful
Ruby on Rails Test / rails-test (push) Successful in 1m49s
All checks were successful
Ruby on Rails Test / rails-test (push) Successful in 1m49s
This commit is contained in:
98
.gitea/workflows/ci-mariadb.yaml
Normal file
98
.gitea/workflows/ci-mariadb.yaml
Normal file
@@ -0,0 +1,98 @@
|
||||
name: Ruby on Rails Test
|
||||
run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} 🚀
|
||||
#on: [push]
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
rails-test:
|
||||
runs-on: ubuntu-22.04
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:11.7.2-noble
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD:-root}"
|
||||
MYSQL_DATABASE: "${DB_DATABASE:-aperonight_test}"
|
||||
MYSQL_USER: "${DB_USERNAME:-aperonight}"
|
||||
MYSQL_PASSWORD: "${DB_PASSWORD:-aperonight}"
|
||||
# RUNNER_TOOL_CACHE: /toolcache
|
||||
#ports:
|
||||
# - "3306:3306"
|
||||
#options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
options: >-
|
||||
--health-cmd="healthcheck.sh --connect --innodb_initialized"
|
||||
--health-interval=10s
|
||||
--health-timeout=5s
|
||||
--health-retries=3
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
DB_HOST: mariadb
|
||||
DB_ROOT_PASSWORD: "${DB_ROOT_PASSWORD:-root}"
|
||||
DB_DATABASE: "${DB_DATABASE:-aperonight_test}"
|
||||
DB_USERNAME: "${DB_USERNAME:-root}"
|
||||
DB_PASSWORD: "${DB_PASSWORD:-root}"
|
||||
RUNNER_TOOL_CACHE: /toolcache # https://about.gitea.com/resources/tutorials/enable-gitea-actions-cache-to-accelerate-cicd
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: .ruby-version # Not needed with a .ruby-version, .tool-versions or mise.toml
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
echo "📦 Installing dependencies..."
|
||||
gem install bundler
|
||||
bundle install --jobs 4 --retry 3
|
||||
npm install -g yarn
|
||||
yarn install
|
||||
echo "📦 Dependencies installed!"
|
||||
|
||||
- name: Cache bundle
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/usr/local/bundle
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |-
|
||||
${{ runner.os }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||
- name: Cache node_modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/node_modules
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |-
|
||||
${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Run migrations
|
||||
run: |
|
||||
echo "🔄 Running migrations..."
|
||||
bundle exec rails db:drop
|
||||
bundle exec rails db:setup
|
||||
bundle exec rails db:migrate
|
||||
echo "🔄 Migrations complete!"
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
echo "🧪 Running tests..."
|
||||
bundle exec rails test
|
||||
echo "🧪 Tests complete!"
|
||||
|
||||
- name: Run linter
|
||||
run: |
|
||||
echo "🚫 Running linter..."
|
||||
bundle exec rubocop
|
||||
echo "🚫 Linter complete!"
|
||||
Reference in New Issue
Block a user