-
Notifications
You must be signed in to change notification settings - Fork 10
68 lines (64 loc) · 1.86 KB
/
backend-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
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