-
Notifications
You must be signed in to change notification settings - Fork 39
177 lines (154 loc) · 6.9 KB
/
front-end-and-services-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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Front-end and Services
on: push
jobs:
catarse_js:
name: Catarse.js
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./services/catarse/catarse.js
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 12.20.0
- name: Yarn package cache
uses: actions/cache@v2
with:
path: ./services/catarse/catarse.js/node_modules
key: ${{ runner.os }}-yarn-v2-${{ hashFiles('./services/catarse/catarse.js/yarn.lock') }}
- name: Install Yarn packages
run: |
yarn policies set-version
yarn install --pure-lockfile
- name: Run tests
run: yarn test
services_core_db:
name: Service Core DB
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./services/service-core-db
steps:
- name: Setup docker container
uses: docker://comum/docker-build-env:latest
- name: Checkout code
uses: actions/checkout@v1
- name: Run tests
run: ./run_sql_tests_with_docker.sh
common_api:
name: Common API
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./services/common-api
services:
postgres:
image: postgres:9.6
ports: ['5432:5432']
env:
POSTGRES_DB: services_core_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: example
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Rust
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
cargo install diesel_cli --no-default-features --features "postgres"
sudo ln -s $HOME/.cargo/bin/diesel /usr/local/bin/diesel
- name: Database Setup
env:
PGPASSWORD: example
run: |
cd ../service-core-db
touch Cargo.toml
psql -U postgres -h localhost -p 5432 services_core_test < ./init.sql
psql -U postgres -h localhost -p 5432 -c "alter user postgrest with superuser;"
DATABASE_URL=postgres://postgres:example@localhost:5432/services_core_test ./scripts/run_migrations.sh
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.1
- name: Cache gems
uses: actions/cache@v2
with:
path: ./services/common-api/vendor/bundle
key: ${{ runner.os }}-gems-common-api-${{ hashFiles('./services/common-api/Gemfile.lock') }}
- name: Install Ruby dependencies
run: |
gem install bundler:2.2.27
bundle config disable_local_branch_check true
bundle config local.common_models ../common_models
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run tests
run: DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true DATABASE_URL=postgres://postgres:example@localhost:5432/services_core_test bundle exec rspec spec
# DISABLED DUE THIS ERROR:
# + gem install nokogiri -- --use-system-libraries --with-xml2-config=/usr/bin/xml2-config --with-xslt-config=/usr/bin/xslt-config
# Building native extensions with: '--use-system-libraries --with-xml2-config=/usr/bin/xml2-config --with-xslt-config=/usr/bin/xslt-config'
# This could take a while...
# ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
# bad response Forbidden 403 (https://api.rubygems.org/quick/Marshal.4.8/nokogiri-1.13.1-x64-unknown.gemspec.rz)
# common_models:
# name: Common Models
# runs-on: ubuntu-20.04
# defaults:
# run:
# working-directory: ./services/service-core-db
# steps:
# - name: Setup docker container
# uses: docker://comum/docker-build-env:latest
# - name: Checkout code
# uses: actions/checkout@v1
# - name: Run tests
# run: |
# docker run -e POSTGRES_PASSWORD=example -e POSTGRES_DB=services_core_test --name pg_default -p 5432:5432 -d postgres:9.6
# docker build -f Dockerfile -t comum/services-core:test .
# cd ../common-api/vendor/gems/common_models/
# docker build -f Dockerfile -t comum/common_models:test .
# cd ../../../../../
# docker run -e PGPASSWORD=example -i --rm --link pg_default:pg_default comum/services-core:test psql -U postgres -h pg_default -p 5432 services_core_test < services/service-core-db/init.sql
# docker run -e PGPASSWORD=example -i --rm --link pg_default:pg_default comum/services-core:test psql -U postgres -h pg_default -p 5432 -c "alter user postgrest with superuser;"
# docker run -i --rm --link pg_default:pg_default -e="DATABASE_URL=postgres://postgres:example@pg_default:5432/services_core_test" comum/services-core:test ./scripts/run_migrations.sh
# docker run -i --rm --link pg_default:localhost.pg -e="RAILS_ENV=test" -e="DATABASE_URL=postgres://postgres:example@localhost.pg:5432/services_core_test" comum/common_models:test bundle exec rspec spec
payment_service:
name: Payment Service
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./services/service-core-db
steps:
- name: Setup docker container
uses: docker://comum/docker-build-env:latest
- name: Checkout code
uses: actions/checkout@v1
- name: Run tests
run: |
docker run -e POSTGRES_PASSWORD=example -e POSTGRES_DB=services_core_test --name pg_default -p 5432:5432 -d postgres:9.6
docker build -f Dockerfile -t comum/services-core:test .
cd ../payment-service-api/
docker build -f Dockerfile -t comum/payment-service:test .
cd ../../
docker run -e PGPASSWORD=example -i --rm --link pg_default:pg_default comum/services-core:test psql -U postgres -h pg_default -p 5432 services_core_test < services/service-core-db/init.sql
docker run -e PGPASSWORD=example -i --rm --link pg_default:pg_default comum/services-core:test psql -U postgres -h pg_default -p 5432 -c "alter user postgrest with superuser;"
docker run -i --rm --link pg_default:pg_default -e="DATABASE_URL=postgres://postgres:example@pg_default:5432/services_core_test" comum/services-core:test ./scripts/run_migrations.sh
docker run -i --rm --link pg_default:localhost.pg -e="RAILS_ENV=test" -e="DATABASE_URL=postgres://postgres:example@localhost.pg:5432/services_core_test" comum/payment-service:test npm test -- -v
proxy_config:
name: Proxy Config
runs-on: ubuntu-20.04
defaults:
run:
working-directory: ./services/proxy
steps:
- name: Setup docker container
uses: docker://comum/docker-build-env:latest
- name: Checkout code
uses: actions/checkout@v1
- name: Run tests
run: ./test.sh