-
-
Notifications
You must be signed in to change notification settings - Fork 85
92 lines (89 loc) · 3.17 KB
/
kpm_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
name: kpm_ci
on: [push, pull_request, workflow_dispatch]
env:
JRUBY_OPTS: --2.0 -J-Xmx1024M
KB_ADDRESS: 0.0.0.0
KB_PORT: 8080
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# See HOMEBREW_PORTABLE_RUBY_VERSION in kpm/tasks/package.rake
ruby-version: ['3.1.4', 'jruby-9.4.5.0']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
working-directory: kpm
- name: Upgrade rubygems
run: |
# See https://github.com/rubygems/rubygems/pull/3146
# gem update --system
gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)
gem update bundler --conservative
- name: Start stack
run: |
cd kpm/docker && docker compose -p it -f docker-compose.ci.mysql.yml up -d
- name: Wait for stack
run: |
count=0
until $(curl --output /dev/null --silent --fail http://${KB_ADDRESS}:${KB_PORT}/1.0/healthcheck); do
if [[ "$count" == "180" ]]; then
exit 64
fi
count=$(( count + 1 ))
sleep 1
done
curl -v \
-X POST \
-u admin:password \
-H 'Content-Type: application/json' \
-H 'X-Killbill-CreatedBy: GitHub' \
-d '{"apiKey": "bob", "apiSecret": "lazar"}' \
"http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/tenants?useGlobalDefault=true"
mysql -uroot -proot -h 0.0.0.0 -e "CREATE USER 'test_user'@'%' IDENTIFIED BY 'test_password'; GRANT ALL PRIVILEGES ON *.* TO 'test_user'@'%'; FLUSH PRIVILEGES;"
- name: Run unit tests
run: |
cd kpm
bundle exec rake test:spec
- name: Run remote tests
env:
CLOUDSMITH_ORG: ${{ secrets.CLOUDSMITH_ORG }}
CLOUDSMITH_REPO: ${{ secrets.CLOUDSMITH_REPO }}
CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }}
TOKEN: ${{ secrets.TOKEN }}
run: |
cd kpm
bundle exec rake test:remote:spec
- name: Run MySQL tests
run: |
cd kpm
bundle exec rake test:mysql:spec
- name: Debugging after failure
if: failure()
run: |
echo "[DEBUG] killbill healthcheck"
curl -v http://${KB_ADDRESS}:${KB_PORT}/1.0/healthcheck || true
echo "[DEBUG] hostname"
hostname
echo "[DEBUG] netstat -tulpn"
sudo netstat -tulpn
echo "[DEBUG] docker network ls"
docker network ls
echo "[DEBUG] docker ps -a"
docker ps -a
echo "[DEBUG] killbill env"
docker exec it_killbill_1 env || true
echo "[DEBUG] db env"
docker exec it-db-1 env || true
echo "[DEBUG] killbill logs"
docker logs --details it_killbill_1 || true
echo "[DEBUG] killbill raw logs"
sudo cat /tmp/it/logs/killbill.out || true
echo "[DEBUG] db logs"
docker logs --details it-db-1 || true