-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (71 loc) · 2.38 KB
/
ci.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: CI
on: [push]
env:
RAILS_ENV: test
CI: true
jobs:
test:
name: Run RSpec
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: opencourts_api_test
RAILS_ENV: test
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- name: Setup ENV File
run: mv .env.ci .env.test
- name: Install Required Packages
run: sudo apt-get install libpq-dev libssl-dev libcurl4 libcurl4-openssl-dev
- name: 'Read Ruby Version'
id: read-ruby-version
run: echo "RUBY_VERSION=$(cat .ruby-version)" >> $GITHUB_OUTPUT
- uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ steps.read-ruby-version.outputs.RUBY_VERSION }}'
bundler-cache: true
- uses: actions/setup-node@v1
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install Bundle
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Install Yarn
run: npm install -g yarn
- name: Get Yarn Cache Dir
id: yarn-cache-dir
run: echo "YARN_CACHE_DIR=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Setup Yarn Cache
id: cache-yarn
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn
run: yarn install
- name: Setup Database
run: |
bin/rails db:create db:schema:load
bin/rails db:test:load_schema
- name: Prepare Code Climate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Run RSpec
run: bin/rspec
- name: Notify Code Climate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?