diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..9842003 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: + - '**' + pull_request: + branches: + - main + +jobs: + test: + name: Tests & couverture + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: https://github.com/actions/checkout@v4 + + - name: Setup Java 25 + uses: https://github.com/actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + cache: 'gradle' + + - name: Run tests + run: ./gradlew test + + - name: Upload test report + if: failure() + uses: https://github.com/actions/upload-artifact@v4 + with: + name: test-report + path: build/reports/tests/test/ diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..918e414 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release + +on: + release: + types: [published] + +jobs: + docker: + name: Build & push Docker image + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: https://github.com/actions/checkout@v4 + + - name: Setup Java 25 + uses: https://github.com/actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + cache: 'gradle' + + - name: Build JAR + run: ./gradlew build -x test + + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + + - name: Login to Gitea container registry + uses: https://github.com/docker/login-action@v3 + with: + registry: git.goutailler-olivier.com + username: ${{ gitea.actor }} + password: ${{ secrets.RELEASE_TOKEN }} + + - name: Set lowercase repo name + id: repo + run: echo "name=$(echo '${{ gitea.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Build and push + uses: https://github.com/docker/build-push-action@v6 + with: + context: . + push: true + tags: | + git.goutailler-olivier.com/${{ steps.repo.outputs.name }}:${{ gitea.ref_name }} + git.goutailler-olivier.com/${{ steps.repo.outputs.name }}:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f79df47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM eclipse-temurin:25-jre-alpine +WORKDIR /app +COPY build/libs/*.jar app.jar +EXPOSE 8080 +ENTRYPOINT ["java", "-jar", "app.jar"]