Skip to content

Commit

Permalink
Add GH CI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrossie committed Mar 11, 2023
1 parent 663b57f commit e92993e
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 3 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,68 @@
name: ci

on:
push:
workflow_dispatch:

env:
GO111MODULE: on
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
KB_ADDRESS: 127.0.0.1
KB_PORT: 8080

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.19'
- name: Download dependencies
run: |
go install golang.org/x/tools/cmd/goimports@latest
go mod download
- name: Start stack
run: |
mkdir -p /var/tmp/tomcat_logs
chmod ugo+rwx /var/tmp/tomcat_logs
cd docker
docker-compose -p it -f docker-compose.ci.mysql.yml up --no-start
docker start it_db_1
- name: Wait for 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: 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 docker-compose.ci.mysql.yml 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
- name: Build and run tests
if: success()
run: |
export PATH="$HOME/go/bin:$PATH"
go test ./...
41 changes: 41 additions & 0 deletions docker/docker-compose.ci.mysql.yml
@@ -0,0 +1,41 @@
#
# Copyright 2020-2022 Equinix, Inc
# Copyright 2014-2022 The Billing Project, LLC
#
# The Billing Project licenses this file to you under the Apache License, version 2.0
# (the "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

version: '3.8'

services:
killbill:
network_mode: host
image: killbill/killbill:0.24.0
environment:
- KILLBILL_CATALOG_URI=SpyCarAdvanced.xml
- KILLBILL_DAO_URL=jdbc:mysql://127.0.0.1:3306/killbill
- KILLBILL_DAO_USER=root
- KILLBILL_DAO_PASSWORD=root
- KILLBILL_SERVER_TEST_MODE=true
- KILLBILL_INVOICE_SANITY_SAFETY_BOUND_ENABLED=false
- KILLBILL_INVOICE_MAX_DAILY_NUMBER_OF_ITEMS_SAFETY_BOUND=-1
depends_on:
- db
volumes:
- /var/tmp/bundles/plugins/java/invgrp-plugin:/var/lib/killbill/bundles/plugins/java/invgrp-plugin
- /var/tmp/tomcat_logs:/var/lib/tomcat/logs
db:
network_mode: host
image: killbill/mariadb:0.24
environment:
- MYSQL_ROOT_PASSWORD=root
4 changes: 2 additions & 2 deletions examples/listaccounts/main.go
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/go-openapi/runtime"
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/killbill/kbcli/v2/kbclient"
"github.com/killbill/kbcli/v2/kbclient/account"
"github.com/killbill/kbcli/v3/kbclient"
"github.com/killbill/kbcli/v3/kbclient/account"
)

// NewClient creates new kill bill client
Expand Down
2 changes: 1 addition & 1 deletion kbcli.go
Expand Up @@ -4,5 +4,5 @@ package kbcli

import (
_ "github.com/go-openapi/runtime"
_ "github.com/killbill/kbcli/v2/kbclient"
_ "github.com/killbill/kbcli/v3/kbclient"
)

0 comments on commit e92993e

Please sign in to comment.