-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (92 loc) · 2.8 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
92
name: CI
on:
workflow_call:
secrets:
SECRET_KEY_BASE:
required: true
SESSION_ENCRYPTED_COOKIE_SALT:
required: true
JWT_PRIVATE_KEY:
required: true
JWT_PUBLIC_KEY:
required: true
ORCID_CLIENT_ID_FOR_TESTING:
required: true
ORCID_TOKEN_FOR_TESTING:
required: true
jobs:
test:
runs-on: ubuntu-latest
services:
memcached:
image: memcached:1.4.31
ports:
- 11211
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: datacite
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
ports:
- 3306
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
env:
discovery.type: single-node
ES_JAVA_OPTS: -Xms512m -Xmx512m
ELASTIC_PASSWORD: changeme
xpack.security.enabled: "false"
http.cors.enabled: "true"
http.cors.allow-origin: "*"
ports:
- 9200
redis:
image: redis
ports:
- 6379
env:
MEMCACHE_SERVERS: "localhost:11211"
MYSQL_HOST: "127.0.0.1"
MYSQL_DATABASE: datacite
MYSQL_USER: root
ES_HOST: "localhost:9200"
ELASTIC_PASSWORD: "changeme"
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
SESSION_ENCRYPTED_COOKIE_SALT: ${{ secrets.SESSION_ENCRYPTED_COOKIE_SALT }}
JWT_PRIVATE_KEY: ${{ secrets.JWT_PRIVATE_KEY }}
JWT_PUBLIC_KEY: ${{ secrets.JWT_PUBLIC_KEY }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby 3.1.4
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install
env:
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
cp .env.build .env
gem install bundler -v 2.4.22
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
# sudo /etc/init.d/mysql start
bundle exec rails db:setup RAILS_ENV=test
- name: Lint and Test
env:
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
ES_HOST: localhost:${{ job.services.elasticsearch.ports[9200] }}
ELASTIC_PASSWORD: "changeme"
MEMCACHE_SERVERS: localhost:${{ job.services.memcached.ports[11211] }}
REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}
ORCID_CLIENT_ID: ${{ secrets.ORCID_CLIENT_ID_FOR_TESTING }}
ORCID_TOKEN: ${{ secrets.ORCID_TOKEN_FOR_TESTING }}
run: |
bundle exec rubocop
bundle exec rspec
echo $?