-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (55 loc) · 2.03 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
name: Continuous Integration
on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
CC_TEST_REPORTER_ID: 353b5634de390dad574939f59c2ef3798b81f06df548f7bdd11cd8225be484f3
services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 32574:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Show postgres version
run: psql -h localhost -U postgres -d postgres -c 'SHOW server_version'
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.0
bundler-cache: true
- name: Install Bundler
run: gem install bundler
- name: Install dependencies
run: bundle install
- name: Create MySQL and PostgreSQL databases
run: |
sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE DATABASE set_as_primary_test;"
psql --host 127.0.0.1 --port 5432 --username postgres --password password -c "CREATE DATABASE set_as_primary_test;"
- name: Run tests
run: bundle exec rake
- name: Set up Code Climate Test Reporter
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: Upload test coverage results to Code Climate
if: always() && ${{ github.ref == 'refs/heads/master' }} # Adjust the branch name if needed
run: ./cc-test-reporter after-build --debug --exit-code ${{ job.status }}