Fix: Fix workflow #135
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" | |
workflow_dispatch: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get ruby version | |
id: ruby-version | |
run: | | |
echo RUBY_VERSION=$(cat backend/.ruby-version) >> $GITHUB_OUTPUT | |
- name: Setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ steps.ruby-version.outputs.RUBY_VERSION }} | |
# - 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.test --profile test up -d | |
cp ../.env.test ../.env | |
bundle exec rake parallel:setup | |
bundle exec rake parallel:spec | |
build: | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'main' | |
needs: | |
- check | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build image | |
uses: ./.github/actions/build | |
with: | |
directory-name: backend |