Merge pull request #1919 from killbill/fix-for-dry-run-issue #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
with: | |
persist-credentials: false | |
- name: Set up JDK | |
uses: actions/[email protected] | |
with: | |
java-version: ${{ matrix.java-version }} | |
distribution: ${{ matrix.java-distribution }} | |
#cache: 'maven' | |
- name: Configure Sonatype mirror | |
uses: s4u/[email protected] | |
# 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/[email protected] | |
if: failure() | |
with: | |
name: failure-${{ matrix.database }} | |
path: /tmp/test-results/killbill.log |