-
-
Notifications
You must be signed in to change notification settings - Fork 748
168 lines (166 loc) · 7.15 KB
/
ci.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: ci
on:
push:
pull_request:
workflow_dispatch:
jobs:
ci:
uses: killbill/gh-actions-shared/.github/workflows/ci.yml@main
e2e:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10
strategy:
matrix:
include:
- ruby-version: '2.5.0'
ref: refs/heads/master
database-adapter: 'mysql2'
database-user: 'root'
database-password: 'root'
database-port: '3306'
database: 'mysql'
java-version: '11'
java-distribution: 'temurin'
maven_version: '3.8.4'
steps:
- name: Checkout killbill
uses: actions/checkout@v2.4.0
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@v2.5.0
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.java-distribution }}
#cache: 'maven'
- name: Configure Sonatype mirror
uses: s4u/maven-settings-action@v2.4.1
# Go to Sonatype directly to avoid delay syncs (could get rid of this if actions/setup-java were to support mirrors).
with:
mirrors: '[{"id": "oss-releases", "name": "Sonatype releases", "mirrorOf": "central", "url": "https://oss.sonatype.org/content/repositories/releases"}]'
sonatypeSnapshots: true
- name: Set up Maven
run: mvn --errors --batch-mode --show-version wrapper:wrapper "-Dmaven=${{ matrix.maven_version }}"
- name: Build Kill Bill
run: ./mvnw --errors --batch-mode --show-version clean install -DskipTests=true -Dcheck.skip-dependency=true -Dcheck.skip-dependency-scope=true -Dcheck.skip-dependency-versions=true -Dcheck.skip-duplicate-finder=true -Dcheck.skip-enforcer=true -Dcheck.skip-rat=true -Dcheck.skip-spotbugs=true
- name: Wait for MySQL
if: ${{ matrix.database == 'mysql' }}
run: |
set +e
count=0
until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
if [[ "$count" == "25" ]]; then
exit 1
fi
(( count++ ))
printf '.'
sleep 5
done
set -e
- name: Wait for PostgreSQL
if: ${{ matrix.database == 'postgresql' }}
run: |
set +e
count=0
until $(psql -h 127.0.0.1 -U postgres -p 5432 -l > /dev/null); do
if [[ "$count" == "25" ]]; then
exit 1
fi
(( count++ ))
printf '.'
sleep 5
done
set -e
- name: Setup latest DDL
if: ${{ matrix.database == 'mysql' }}
run: |
mysql -h 127.0.0.1 -u root --password=root -e 'create database killbill'
./bin/db-helper -a create --driver mysql -u root -p root -t yes -h 127.0.0.1
- name: Setup latest DDL
if: ${{ matrix.database == 'postgresql' }}
run: |
psql -h 127.0.0.1 -U postgres -p 5432 -c 'create database killbill'
./bin/db-helper -a create --driver postgres -u postgres -t yes -h 127.0.0.1 --port 5432
- name: Install plugin specific MySQL DDL
if: ${{ matrix.database == 'mysql' }}
run: |
curl https://raw.githubusercontent.com/killbill/killbill-avatax-plugin/master/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
curl https://raw.githubusercontent.com/killbill/killbill-payment-test-plugin/master/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
curl https://raw.githubusercontent.com/killbill/killbill-email-notifications-plugin/master/src/main/resources/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
- name: Install plugin specific PostgreSQL DDL
if: ${{ matrix.database == 'postgresql' }}
run: |
curl https://raw.githubusercontent.com/killbill/killbill-avatax-plugin/master/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
curl https://raw.githubusercontent.com/killbill/killbill-payment-test-plugin/master/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
curl https://raw.githubusercontent.com/killbill/killbill-email-notifications-plugin/master/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
- name: Start Kill Bill
timeout-minutes: 4
run: |
mkdir -p /tmp/test-results
nohup ./bin/start-server -s > /tmp/test-results/killbill.log 2>&1 &
count=0
until $(curl --connect-timeout 10 --max-time 30 --output /dev/null --silent --fail http://127.0.0.1:8080/1.0/healthcheck); do
if [[ "$count" == "180" ]]; then
exit 64
fi
count=$(( count + 1 ))
sleep 1
done
curl --connect-timeout 10 --max-time 30 -v \
-X POST \
-u admin:password \
-H 'Content-Type: application/json' \
-H 'X-Killbill-CreatedBy: GitHub' \
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
"http://127.0.0.1:8080/1.0/kb/tenants"
- name: Checkout killbill-integration-tests
uses: actions/checkout@v2
with:
persist-credentials: false
path: killbill-integration-tests
repository: killbill/killbill-integration-tests
ref: ${{ matrix.ref }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
# Required for caching
working-directory: ${{github.workspace}}/killbill-integration-tests
bundler-cache: true
- name: Install dependencies
working-directory: ${{github.workspace}}/killbill-integration-tests
run: |
bundle install --jobs=4 --retry=3
- name: Run core tests
env:
DB_ADAPTER: ${{ matrix.database-adapter }}
DB_USER: ${{ matrix.database-user }}
DB_PASSWORD: ${{ matrix.database-password }}
DB_PORT: ${{ matrix.database-port }}
working-directory: ${{github.workspace}}/killbill-integration-tests
run: |
bundle exec rake test:core TESTOPTS="--stop-on-failure"
# https://github.com/killbill/killbill-integration-tests/issues/43
# TODO add missing creds
# - name: Run plugins tests
# env:
# DB_ADAPTER: ${{ matrix.database-adapter }}
# DB_USER: ${{ matrix.database-user }}
# DB_PASSWORD: ${{ matrix.database-password }}
# DB_PORT: ${{ matrix.database-port }}
# working-directory: ${{github.workspace}}/killbill-integration-tests
# run: |
# bundle exec rake test:plugins TESTOPTS="--stop-on-failure"
- name: Upload artifact on failure
uses: actions/upload-artifact@v2.3.1
if: failure()
with:
name: failure-${{ matrix.database }}
path: /tmp/test-results/killbill.log