summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/ci.yml')
-rw-r--r--.github/workflows/ci.yml77
1 files changed, 77 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..170f5dc
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,77 @@
+name: CI
+
+on:
+ push:
+ branches: [ 'master' ]
+ pull_request:
+ branches: [ 'master' ]
+ release:
+ types: [ 'created' ]
+
+permissions:
+ contents: read
+
+jobs:
+ tests:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v3
+ - name: Execute tests
+ run: ./gradlew test
+ integrationTests:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v3
+ - name: Execute integration tests
+ run: ./gradlew integrationTest
+ build:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+ needs:
+ - tests
+ - integrationTests
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v3
+ # Setup and build docker image
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+ - name: Build image
+ run: ./gradlew bootBuildImage
+ # Deploy docker image
+ - name: Login to Docker Hub
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Deploy release image
+ if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
+ run: |
+ docker tag ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}:${{ github.ref_name }}
+ docker push ghcr.io/${{ github.repository }}
+ docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }}
+ - name: Deploy preview image
+ if: ${{ github.ref == 'refs/heads/master' }}
+ run: |
+ docker tag ghcr.io/${{ github.repository }} ghcr.io/${{ github.repository }}:preview
+ docker push ghcr.io/${{ github.repository }}:preview \ No newline at end of file