forked from WING-NUS/SSID
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (114 loc) · 3.65 KB
/
verify.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: Verify
on: [push, pull_request]
jobs:
linters:
name: Linters
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- run: |
git fetch --no-tags --unshallow --prune origin +refs/heads/*:refs/remotes/origin/*
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run linters
run: |
bundle exec pronto run -c origin/master --exit-code
# bundle exec stylelint
# bundle exec prettier
# bundle exec eslint --fix $(git diff --name-only HEAD | xargs)
env:
PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
PRONTO_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# security_checks:
# name: Security checks
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - run: |
# git fetch --no-tags --prune origin +refs/heads/*:refs/remotes/origin/*
# - name: Setup Ruby and install gems
# uses: ruby/setup-ruby@v1
# with:
# bundler-cache: true
# - name: Run security checks
# run: |
# bundle exec bundler-audit --update
# bundle exec brakeman -q -w2
tests:
name: Tests
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_HOST: 127.0.0.1
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_DATABASE: ssid_test
MYSQL_ROOT_PASSWORD: root
ports:
- "3306:3306"
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
# - name: Setup Node
# uses: actions/setup-node@v2
# with:
# node-version: 16
# cache: yarn
- name: Install packages
run: |
yarn install --pure-lockfile
- name: Setup test database
env:
RAILS_ENV: test
DATABASE_PORT: 3306
DB_HOST: 127.0.0.1
DB_CONNECTION: mysql
DB_DATABASE: ssid_test
DB_USER: root
DB_PASSWORD: root
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ssid_test;' -u root -proot
bundle exec rails db:create
bundle exec rails db:migrate RAILS_ENV=test
bundle exec rails db:seed
- name: Install wkhtmltopdf
run: |
sudo apt-get update
sudo apt-get install -y wkhtmltopdf
- name: Install chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- name: Show chrome version
run: |
echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} ${{ steps.setup-chrome.outputs.chrome-path }} --version
- name: Setup chromedriver
uses: nanasess/setup-chromedriver@v2
- name: Run local server for testing
run: |
bundle exec rails server -d -p 3000 -e test
sleep 5
- name: Run tests
run: |
bundle exec rspec spec/api_requests/
bundle exec rspec spec/routes
# bundle exec rspec spec/landing_page_spec.rb
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./coverage/lcov.info"