Uodate: setup-ruby v2 #321
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: "[backend] Lint and Test" | |
on: | |
push: | |
paths: | |
- "backend/**" | |
- ".github/workflows/backend-*.yml" | |
- "Rakefile" | |
- "config.test.yml" | |
branches: | |
- main | |
pull_request: | |
paths: | |
- "backend/**" | |
- ".github/workflows/backend-*.yml" | |
- "Rakefile" | |
- "config.test.yml" | |
workflow_dispatch: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup ruby | |
uses: ruby/setup-ruby@v2 | |
- name: Setup .env | |
run: | | |
cp ./config.test.yml ./config.yml | |
rake configure | |
# - name: Cache gems | |
# uses: actions/cache@v3 | |
# id: cache-gems | |
# with: | |
# path: vendor/bundle | |
# key: ${{ runner.os }}-bundler-${{ hashFiles('**/Gemfile.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-bundler- | |
# FIXME: Fix after https://github.com/actions/runner/issues/449 | |
- name: Install gems | |
if: steps.cache-gems.outputs.cache-hit != 'true' | |
working-directory: ./backend | |
run: | | |
bundle config path vendor/bundle | |
bundle config set frozen 'true' | |
bundle install --jobs 4 --retry 3 | |
- name: Run backend lint | |
working-directory: ./backend | |
run: | | |
pwd | |
bundle exec rake lint | |
- name: Run backend test | |
working-directory: ./backend | |
run: | | |
pwd | |
cp ../docker-compose.dev.yml ../docker-compose.yml | |
docker compose --env-file ../.env --profile test up -d | |
export CONSOLE_OUTPUT=XTerm | |
bundle exec rake db:setup | |
bundle exec rake db:migrate | |
bundle exec rake spec | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- check | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build image | |
uses: ./.github/actions/build | |
with: | |
directory-name: backend |