generated from drabkirn/rails_base
-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (108 loc) · 3.69 KB
/
main.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
name: Feedka_CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${ GITHUB_REF }
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checking out latest push
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.5
- name: Setup MYSQL
uses: mirromutth/mysql-action@v1.1
with:
mysql root password: ${{ secrets.MYSQL_ROOT_PASSWORD }}
- name: Cache Ruby Gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup Node and Yarn
uses: actions/setup-node@v2
with:
node-version: '12.22.7'
cache: 'yarn'
- name: "Cache Yarn"
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- name: Install Dependencies
run: |
sudo apt install -yqq libmysqlclient-dev xvfb firefox
wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
tar -zxvf geckodriver-v0.26.0-linux64.tar.gz
sudo mv geckodriver /usr/local/bin/
export DISPLAY=':99.0'
Xvfb :99.0 > /dev/null 2>&1 &
gem install bundler
- name: Install Gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Setup Code Climate
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Prepare Database and run tests
env:
db_hostname: ${{ secrets.MYSQL_HOSTNAME }}
db_username: ${{ secrets.MYSQL_USERNAME }}
db_password: ${{ secrets.MYSQL_ROOT_PASSWORD }}
db_name: ${{ secrets.MYSQL_DB_NAME }}
RAILS_ENV: "test"
app_hostname: "localhost"
app_port: "3000"
devise_secret_key: ${{ secrets.DEVISE_SECRET_KEY }}
devise_pepper_hash: ${{ secrets.DEVISE_PEPPER_HASH }}
ci_true: true
capybara_screenshots_path: tmp/capybara_screenshots
content_moderation_url: "https://contentmoderation.feedka.xyz/test"
content_moderation_api_key: "abcd"
encrypt_key: ${{ secrets.ENCRYPT_KEY }}
run: |
bundle exec rails db:prepare
bundle exec rspec
- name: Publish Code Coverage
run: |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
./cc-test-reporter after-build -r ${{secrets.CC_TEST_REPORTER_ID}}
- name: Create Coverage Artifact
uses: actions/upload-artifact@v2
with:
name: code-coverage
path: coverage/
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.5
- name: Install Brakeman
run: |
gem install brakeman
- name: Run Brakeman
run: |
brakeman -f json > tmp/brakeman.json || exit 0
- name: Brakeman Report
uses: devmasx/brakeman-linter-action@v1.0.0
env:
REPORT_PATH: tmp/brakeman.json
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}