Skip to content

Fix for ci failures #189

Fix for ci failures

Fix for ci failures #189

Workflow file for this run

name: ci
on:
- pull_request
- push
- workflow_dispatch
env:
MAVEN_FLAGS: "-B --no-transfer-progress"
MAVEN_OPTS: "-Xmx2G -XX:+ExitOnOutOfMemoryError -Dmaven.wagon.rto=60000 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3"
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
KB_ADDRESS: 127.0.0.1
KB_PORT: 8080
AVATAX_URL: ${{ secrets.AVATAX_URL }}
AVATAX_ACCOUNT_ID: ${{ secrets.AVATAX_ACCOUNT_ID }}
AVATAX_LICENSE_KEY: ${{ secrets.AVATAX_LICENSE_KEY }}
AVATAX_COMPANY_CODE: ${{ secrets.AVATAX_COMPANY_CODE }}
AVATAX_COMMIT_DOCUMENTS: false
AVATAX_TAXRATESAPI_URL: ${{ secrets.AVATAX_TAXRATESAPI_URL }}
AVATAX_TAXRATESAPI_ACCOUNT_ID: ${{ secrets.AVATAX_TAXRATESAPI_ACCOUNT_ID }}
AVATAX_TAXRATESAPI_LICENSE_KEY: ${{ secrets.AVATAX_TAXRATESAPI_LICENSE_KEY }}
STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }}
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_PUBLIC_KEY }}
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- ruby-version: '2.5.0'
database-adapter: 'mysql2'
database-user: 'root'
database-password: 'root'
database-port: '3306'
docker-compose-file: 'docker-compose.ci.mysql.yml'
java-version: '8'
java-distribution: 'adopt'
- ruby-version: '2.5.0'
database-adapter: 'postgresql'
database-user: 'postgres'
database-password: 'postgres'
database-port: '5432'
docker-compose-file: 'docker-compose.ci.postgresql.yml'
java-version: '8'
java-distribution: 'adopt'
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
- name: Install dependencies
run: |
bundle install --jobs=4 --retry=3
- name: Start stack
run: |
cd docker
docker compose -p it -f ${{ matrix.docker-compose-file }} up --no-start
docker start it-db-1
- name: Wait for MySQL
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.mysql.yml' }}
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.docker-compose-file == 'docker-compose.ci.postgresql.yml' }}
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: Install plugin specific MySQL DDL
if: ${{ matrix.docker-compose-file == 'docker-compose.ci.mysql.yml' }}
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-analytics-plugin/master/src/main/resources/org/killbill/billing/plugin/analytics/ddl.sql | mysql -h 127.0.0.1 -u root --password=root killbill
# Already in the image
#curl https://raw.githubusercontent.com/killbill/killbill-stripe-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-braintree/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
curl https://raw.githubusercontent.com/killbill/killbill-deposit-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-adyen-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-qualpay-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.docker-compose-file == 'docker-compose.ci.postgresql.yml' }}
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-analytics-plugin/master/src/main/resources/org/killbill/billing/plugin/analytics/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
# Already in the image
#curl https://raw.githubusercontent.com/killbill/killbill-stripe-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-braintree/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
curl https://raw.githubusercontent.com/killbill/killbill-deposit-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-adyen-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-qualpay-plugin/master/src/main/resources/ddl.sql | psql -h 127.0.0.1 -U postgres -p 5432 -d killbill
- name: Start Kill Bill
# Sometimes it gets stuck (if Kill Bill starts when the DB isn't ready?)
timeout-minutes: 4
run: |
# Start all remaining containers
cd docker
docker compose -p it -f ${{ matrix.docker-compose-file }} up -d
count=0
until $(curl --connect-timeout 10 --max-time 30 --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 --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://${KB_ADDRESS}:${KB_PORT}/1.0/kb/tenants"
- 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 }}
run: |
# Some flakiness unfortunately
./bin/retry bundle exec rake test:core TESTOPTS="--stop-on-failure"
- 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 }}
run: |
# https://github.com/killbill/killbill-integration-tests/issues/43
#./bin/retry bundle exec rake test:plugins TESTOPTS="--stop-on-failure"
# Some flakiness unfortunately
echo "::group::Avatax"
./bin/retry bundle exec rake test:plugins:avatax TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Analytics"
./bin/retry bundle exec rake test:plugins:analytics TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Stripe"
./bin/retry bundle exec rake test:plugins:stripe TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Braintree"
# No release yet
#./bin/retry bundle exec rake test:plugins:braintree TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Deposit"
./bin/retry bundle exec rake test:plugins:deposit TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Payment test"
./bin/retry bundle exec rake test:plugins:payment-test TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Email notifications test"
./bin/retry bundle exec rake test:plugins:email-notifications TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::GoCardless"
./bin/retry bundle exec rake test:plugins:gocardless TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Qualpay"
./bin/retry bundle exec rake test:plugins:qualpay TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Invoice Group"
./bin/retry bundle exec rake test:plugins:invgrp TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Adyen"
./bin/retry bundle exec rake test:plugins:adyen TESTOPTS="--stop-on-failure"
echo "::endgroup::"
echo "::group::Catalog Test"
./bin/retry bundle exec rake test:plugins:catalog-test TESTOPTS="--stop-on-failure"
echo "::endgroup::"
- name: Debugging after failure
if: failure()
run: |
echo "::group::killbill healthcheck"
curl --connect-timeout 10 --max-time 30 -v http://${KB_ADDRESS}:${KB_PORT}/1.0/healthcheck || true
echo "::endgroup::"
echo "::group::killbill nodesinfo"
curl --connect-timeout 10 --max-time 30 -u admin:password -v http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/nodesInfo || true
echo "::endgroup::"
echo "::group::hostname"
hostname
echo "::endgroup::"
echo "::group::netstat -tulpn"
sudo netstat -tulpn
echo "::endgroup::"
echo "::group::docker network ls"
docker network ls
echo "::endgroup::"
echo "::group::docker ps -a"
docker ps -a
echo "::endgroup::"
echo "::group::killbill env"
docker exec it-killbill-1 env || true
echo "::endgroup::"
echo "::group::db env"
docker exec it-db-1 env || true
echo "::endgroup::"
echo "::group::killbill logs"
(docker logs -t --details it-killbill-1 || true) | tee /var/tmp/killbill.txt
echo "::endgroup::"
echo "::group::db logs"
docker logs -t --details it-db-1 || true
echo "::endgroup::"
- name: Upload logs
uses: actions/[email protected]
if: failure()
with:
name: killbill-${{ matrix.docker-compose-file }}.txt
path: /var/tmp/killbill.txt
retention-days: 1