KtorBase-Example #323
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: KtorBase-Example | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "0 1 * * *" | |
release: | |
types: [ published ] | |
jobs: | |
github-build-and-test: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-example-ktorbase-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle-example-ktorbase- | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Initialize | |
run: > | |
curl -O -s "https://raw.githubusercontent.com/linked-planet/ktorbase/master/init.sh"; | |
sh ./init.sh /tmp com.linked-planet ktor-example "master"; | |
echo "Creating temporary repository with initial version ..."; | |
cd /tmp/com.linked-planet.ktor-example; | |
git init; | |
git config user.email "[email protected]"; | |
git config user.name "test"; | |
git add .; | |
git commit -m "Initial commit" | |
- name: Update | |
run: > | |
curl -O -s "https://raw.githubusercontent.com/linked-planet/ktorbase/master/update.sh"; | |
sh ./update.sh /tmp/com.linked-planet.ktor-example com.linked-planet ktor-example "master"; | |
echo "Comparing updated version with initial version ..."; | |
cd /tmp/com.linked-planet.ktor-example; | |
git add .; | |
git diff --cached --exit-code | |
- name: Gradle Build | |
run: cd /tmp/com.linked-planet.ktor-example && ./gradlew build | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} | |
role-session-name: GitHubActionsSession | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Docker Build and Push | |
working-directory: /tmp/com.linked-planet.ktor-example | |
env: | |
AWS_REGISTRY_URL: ${{ secrets.AWS_REGISTRY_URL }} | |
run: ./pipelines/docker-build-push-aws.sh latest ${GITHUB_SHA} | |
- name: Deploy CloudFormation | |
working-directory: /tmp/com.linked-planet.ktor-example | |
run: ./pipelines/deploy.sh test ${GITHUB_SHA} && ./pipelines/deploy-wait.sh test ${GITHUB_SHA} | |
- name: Run Integration Tests | |
working-directory: /tmp/com.linked-planet.ktor-example | |
env: | |
BACKEND_BASE_URL: https://ktorbase.opencpms.io/ | |
BACKEND_PORT: 443 | |
run: ./gradlew integrationTest |