|
8 | 8 | - '*' |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - runs-on: ubuntu-latest |
12 | | - services: |
13 | | - postgres: |
14 | | - image: postgres:13 |
15 | | - env: |
16 | | - POSTGRES_USER: postgres |
17 | | - POSTGRES_PASSWORD: password |
18 | | - options: >- |
19 | | - --health-cmd pg_isready |
20 | | - --health-interval 10s |
21 | | - --health-timeout 5s |
22 | | - --health-retries 5 |
23 | | - ports: [ '5432:5432' ] |
| 11 | + test: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + services: |
| 14 | + postgres: |
| 15 | + image: postgres:13 |
| 16 | + env: |
| 17 | + POSTGRES_USER: postgres |
| 18 | + POSTGRES_PASSWORD: password |
| 19 | + options: >- |
| 20 | + --health-cmd pg_isready |
| 21 | + --health-interval 10s |
| 22 | + --health-timeout 5s |
| 23 | + --health-retries 5 |
| 24 | + ports: [ '5432:5432' ] |
24 | 25 |
|
25 | | - steps: |
26 | | - - name: Checkout |
27 | | - uses: actions/checkout@v2 |
28 | | - |
29 | | - - name: Setup ruby |
30 | | - uses: ruby/setup-ruby@v1 |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v2 |
31 | 29 |
|
32 | | - - name: Setup node |
33 | | - uses: actions/setup-node@v2 |
34 | | - with: |
35 | | - node-version: '14' |
| 30 | + - name: Setup ruby |
| 31 | + uses: ruby/setup-ruby@v1 |
36 | 32 |
|
37 | | - - name: Get yarn cache directory path |
38 | | - id: yarn-cache-dir-path |
39 | | - run: echo "::set-output name=dir::$(yarn config get cacheFolder)" |
40 | | - |
41 | | - - name: Cache yarn |
42 | | - uses: actions/cache@v2 |
43 | | - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
44 | | - with: |
45 | | - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
46 | | - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
47 | | - restore-keys: | |
48 | | - ${{ runner.os }}-yarn |
| 33 | + - name: Setup node |
| 34 | + uses: actions/setup-node@v2 |
| 35 | + with: |
| 36 | + node-version: '14' |
49 | 37 |
|
50 | | - - name: Cache gems |
51 | | - uses: actions/cache@v2 |
52 | | - with: |
53 | | - path: vendor/bundle |
54 | | - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} |
55 | | - restore-keys: | |
56 | | - ${{ runner.os }}-gems- |
| 38 | + - name: Get yarn cache directory path |
| 39 | + id: yarn-cache-dir-path |
| 40 | + run: echo "::set-output name=dir::$(yarn config get cacheFolder)" |
| 41 | + |
| 42 | + - name: Cache yarn |
| 43 | + uses: actions/cache@v2 |
| 44 | + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) |
| 45 | + with: |
| 46 | + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
| 47 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 48 | + restore-keys: | |
| 49 | + ${{ runner.os }}-yarn |
| 50 | + |
| 51 | + - name: Cache gems |
| 52 | + uses: actions/cache@v2 |
| 53 | + with: |
| 54 | + path: vendor/bundle |
| 55 | + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} |
| 56 | + restore-keys: | |
| 57 | + ${{ runner.os }}-gems- |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + run: | |
| 61 | + gem install bundler |
| 62 | + bundle config path vendor/bundle |
| 63 | + bundle install --jobs 4 --retry 3 |
| 64 | + yarn install --frozen-lockfile |
57 | 65 | |
58 | | - - name: Install dependencies |
59 | | - run: | |
60 | | - gem install bundler |
61 | | - bundle config path vendor/bundle |
62 | | - bundle install --jobs 4 --retry 3 |
63 | | - yarn install --frozen-lockfile |
64 | | - |
65 | | - - name: Run tests |
66 | | - env: |
67 | | - DATABASE_URL: postgres://postgres:password@localhost:5432/test |
68 | | - RAILS_ENV: test |
69 | | - RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} |
70 | | - run: | |
71 | | - bin/rails db:test:prepare |
72 | | - bundle exec rspec |
| 66 | + - name: Run tests |
| 67 | + env: |
| 68 | + DATABASE_URL: postgres://postgres:password@localhost:5432/test |
| 69 | + RAILS_ENV: test |
| 70 | + RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} |
| 71 | + run: | |
| 72 | + bin/rails db:test:prepare |
| 73 | + bundle exec rspec |
0 commit comments