-
Notifications
You must be signed in to change notification settings - Fork 33
133 lines (110 loc) · 3.94 KB
/
build.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Cryptopus CI build
on:
push:
branches:
- master
- stable
pull_request:
# scheduled for 2AM UTC
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
build:
name: Build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_PASSWORD: password
env:
RAILS_DB_ADAPTER: 'postgresql'
RAILS_DB_HOST: 'localhost'
RAILS_DB_PORT: 5432
RAILS_DB_USERNAME: postgres
RAILS_DB_PASSWORD: password
RAILS_DB_NAME: cryptopus_test
RAILS_ENV: test
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby 3.2
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
# Setup Node
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '20.14.0'
# Npm global packages caching
- name: Cache global npm modules
id: global-node-modules-cache
uses: actions/cache@v2
env:
cache-name: cache-global-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux
path: ~/.npm
key: ${{ runner.os }}-global-build-cache-v1-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-global-build-cache-v1-${{ hashFiles('**/package-lock.json') }}
# Node modules caching
- name: Cache node modules
id: node-modules-cache
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm modules cache files are stored in `./node_modules`
path: ./node_modules'
key: ${{ runner.os }}-build-cache-v1-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-cache-v1-${{ hashFiles('**/package-lock.json') }}
- name: Install bundler
run: gem install bundler:2.3.13
- name: Create database
run: bundle exec rails db:setup
- name: Run yarn
if: steps.node-modules-cache.outputs.cache-hit != 'true' || steps.global-node-modules-cache.outputs.cache-hit != 'true'
run: yarn
- name: Add ember-cli
run: yarn global add ember-cli
- name: Add npm
run: yarn global add npm
- name: Set yarn prefix
run: yarn config set --prefix ./frontend install ./frontend
- name: Clear Logs
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: bundle exec rake ci:clear_logs --trace
- name: Rubocop
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: bundle exec rake ci:rubocop --trace
- name: Brakeman
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: bundle exec rake ci:brakeman --trace
# Frontend prepare
- name: Prepare Frontend
run: bundle exec rake ci:frontend_prepare --trace
# Frontend specs
- name: Run frontend specs
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: bundle exec rake ci:frontend_specs --trace
- name: Run backend specs
if: github.event_name == 'push' || github.event_name == 'pull_request'
run: bundle exec rake ci:spec --trace
# Run end-to-end tests
- name: Run system specs
if: github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
run: bundle exec rake nightly:e2e --trace
# Cleanup
- name: Run rake frontend clean
run: bundle exec rake frontend:clean