Skip to content

KtorBase

KtorBase #342

Workflow file for this run

name: KtorBase
on:
push:
branches:
- '**'
schedule:
- cron: "0 1 * * *"
release:
types: [ published ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-ktorbase-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-ktorbase-
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Gradle Build
run: ./gradlew build
- name: Extract Version
id: extract-version
run: |
VERSION="$(./gradlew cV | grep "Project version" | cut -d ":" -f2 | xargs)"
echo "Detected version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: .
load: ${{ github.event_name != 'release' }}
push: ${{ github.event_name == 'release' }}
tags: |
linkedplanet/ktorbase:latest
linkedplanet/ktorbase:${{ env.VERSION }}
- name: Start KtorBase
run: docker run -d -p 9090:9090 -e APPLICATION_SECRET=0000000000000000000000000000000 linkedplanet/ktorbase:latest
- name: Await Start-up
run: wget --tries 10 http://localhost:9090/health
- name: Run Integration Tests
run: ./gradlew integrationTest