-
Notifications
You must be signed in to change notification settings - Fork 4
102 lines (101 loc) · 3.6 KB
/
Copy pathtest.yml
File metadata and controls
102 lines (101 loc) · 3.6 KB
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
# .github/workflows/test.yml
name: test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Set N number of parallel jobs you want to run tests on.
# Use higher number if you have slow tests to split them on more parallel jobs.
# Remember to update ci_node_index below to 0..N-1
ci_node_total: [2]
# set N-1 indexes for parallel jobs
# When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc
ci_node_index: [0, 1]
env:
BUNDLE_JOBS: 2
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
PGHOST: 127.0.0.1
PGUSER: postgres
PGPASSWORD: postgres
RAILS_ENV: test
services:
postgres:
image: postgres:9.6-alpine
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: bookmarker_test
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Setup chromedriver
uses: nanasess/setup-chromedriver@master
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get -yqq install libpq-dev
sudo apt-get install -y --no-install-recommends wget xvfb xauth unzip libpq-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev
sudo apt-get -y install g++ qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x libxml2-dev libxslt1-dev
sudo apt-get update -y
sudo apt-get install yarn
- name: Bundle Install
run: |
gem install bundler
bundle config path vendor/bundle
bundle check || bundle install --jobs 4 --retry 3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn package
run: |
yarn install --pure-lockfile
- name: Database prepare
run: bundle exec rails db:prepare
- name: Make bin/ci executeable
run: chmod +x ./bin/ci
- name: Run Rspec test
id: rspec-test
env:
# Specifies how many jobs you would like to run in parallel,
# used for partitioning
CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
# Use the index from matrix as an environment variable
CI_NODE_INDEX: ${{ matrix.ci_node_index }}
continue-on-error: true
run : |
./bin/ci
- name: Upload failed screenshots
uses: actions/upload-artifact@master
with:
name: failed-screenshots
path: ${{ github.workspace }}/tmp/screenshots
- name: Notify failure if rspec test fail, workaround for continue-on-error
if: steps.rspec-test.outcome != 'success'
run: exit 1