forked from DMPRoadmap/roadmap
-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (86 loc) · 3.29 KB
/
mysql.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
name: Tests - MySQL
on: [pull_request]
jobs:
mysql:
runs-on: ubuntu-latest
env:
DB_ADAPTER: mysql2
MYSQL_PWD: root
RAILS_ENV: test
steps:
# Checkout the repo
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 'Install MySQL Packages'
run: |
sudo apt-get update
sudo apt-get install -y mysql-client libmysqlclient-dev
- name: 'Determine Ruby and Bundler Versions from Gemfile.lock'
run: |
echo "RUBY_VERSION=`cat ./Gemfile.lock | grep -A 1 'RUBY VERSION' | grep 'ruby' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV
echo "BUNDLER_VERSION=`cat ./Gemfile.lock | grep -A 1 'BUNDLED WITH' | grep -oE '[0-9]\.[0-9]'`" >> $GITHUB_ENV
- name: 'Install Ruby'
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
# Copy all of the example configs over
- name: 'Setup Default Configuration'
run: |
# Make copies of all the example config files
cp config/database.yml.sample config/database.yml
cp config/initializers/contact_us.rb.example config/initializers/contact_us.rb
cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb
# Try to retrieve the gems from the cache
- name: 'Cache Gems'
uses: actions/cache@v2.1.5
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: 'Bundle Install'
run: |
gem install bundler -v ${{ env.BUNDLER_VERSION }}
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3 --without pgsql rollbar aws
- name: 'Setup Credentials'
run: |
# generate a default credential file and key
EDITOR='echo "$(cat config/credentials.yml.example)" >' bundle exec rails credentials:edit
# Try to retrieve the yarn JS dependencies from the cache
- name: 'Cache Yarn Packages'
uses: actions/cache@v2.1.5
with:
path: node_modules/
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-yarn-
${{ runner.os }}-
- name: 'Determine wkhtmltopdf location'
run: echo "WICKED_PDF_PATH=`bundle exec which wkhtmltopdf`" >> $GITHUB_ENV
- name: 'Yarn Install'
run: |
yarn install
- name: 'Start MySQL'
run: sudo systemctl start mysql
- name: 'Setup Test DB'
run: bin/rails db:setup RAILS_ENV=test
- name: 'Migrate DB'
run: bin/rails db:migrate RAILS_ENV=test
- name: 'Compile Assets'
run: |
bin/rails webpacker:compile
bin/rails assets:precompile
- name: 'Run Karma Tests'
run: yarn test
- name: 'Run Rspec Unit and Functional Tests'
run: |
bin/bundle exec rspec spec/models/ spec/policies/ spec/services/ spec/helpers/
bin/bundle exec rspec spec/controllers/ spec/presenters/ spec/requests/ spec/views
bin/bundle exec rspec spec/mixins/
# Only run Integration tests if the PR or Push is to master or development branches
- name: 'Run Rspec Integration Tests'
run: bin/bundle exec rspec spec/features/