-
Notifications
You must be signed in to change notification settings - Fork 5
131 lines (111 loc) · 3.63 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
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
name: CI
on:
push:
env:
DATABASE_URL: postgres://postgres@localhost:5432
OPENSEARCH_URL: http://localhost:9200
REDIS_URL: redis://localhost:6379
RAILS_ENV: test
ANTIVIRUS_URL: http://localhost:3006/safe
ANTIVIRUS_USERNAME: av
ANTIVIRUS_PASSWORD: password
PSD_HOST: example.com
PSD_HOST_SUPPORT: example.com
PSD_HOST_REPORT: example.com
EMAIL_WHITELIST_ENABLED: false
TWO_FACTOR_AUTHENTICATION_ENABLED: false
CI: true
jobs:
ruby:
name: "Rspec"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ""
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
opensearch:
image: opensearchproject/opensearch:1.2.3
env:
DISABLE_SECURITY_PLUGIN: true
ports: ["9200:9200"]
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
strategy:
fail-fast: false
matrix:
rspec-folder:
- spec/active_model
- spec/decorators
- spec/forms
- spec/helpers spec/jobs spec/mailers spec/policies
- spec/models spec/validators
- spec/requests
- --tag with_opensearch spec/features
- --tag ~with_opensearch spec/features
- --tag with_opensearch spec/services
- --tag ~with_opensearch spec/services
- $(ls -d spec/*/ | grep -v -E 'decorators|models|active_model|forms|jobs|mailers|requests|features|policies|services|helpers|validators')
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 18.15.x
- name: Install PostgreSQL client
run: sudo apt-get install libpq-dev
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-no-dev-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install RubyGems
run: |
gem install bundler --no-doc
bundle config path vendor/bundle
bundle check || bundle install --without development --jobs=4 --retry=3
- name: Install yarn
run: npm install yarn -g
- name: Get yarn cache
id: yarn-cache
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Prepare database
run: bin/rails parallel:load_schema
- name: Prepare assets for tests
run: bin/rails test:prepare
- name: Run specs
run: |
bundle exec rspec ${{ matrix.rspec-folder }}
# - name: Coveralls
# uses: coverallsapp/github-action@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Dump docker logs
uses: jwalton/gh-docker-logs@v2
if: always()
with:
images: 'opensearchproject/opensearch'
- uses: actions/upload-artifact@v4
if: failure()
with:
name: capybara screenshots
path: tmp/capybara