chore(deps): update dependency com.ncorti.ktfmt.gradle to v0.21.0 #10831
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: CI/CD | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
JAVA_VERSION: 17 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.2 | |
- name: Build with Gradle | |
uses: DanySK/build-check-deploy-gradle-action@3.5.28 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
should-run-codecov: false | |
test: | |
needs: build | |
if: ${{ needs.build.result == 'success' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
# Commented until we find a way to run containertests on macOS and Windows | |
# - macos-14 | |
# - windows-2022 | |
- ubuntu-24.04 | |
java-version: [17, 21] | |
java-distribution: | |
- adopt | |
- corretto | |
runs-on: ${{ matrix.os }} | |
concurrency: | |
group: build-${{ github.workflow }}-${{ matrix.os }}-${{ matrix.java-version }}-${{ matrix.java-distribution }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.2 | |
- uses: DanySK/build-check-deploy-gradle-action@3.5.28 | |
with: | |
java-version: ${{ matrix.java-version }} | |
java-distribution: ${{ matrix.java-distribution }} | |
should-run-codecov: false | |
release: | |
needs: | |
- build | |
- test | |
if: >- | |
github.event_name != 'pull_request' | |
&& github.ref == 'refs/heads/main' | |
&& contains(needs.*.result, 'success') | |
&& !contains(needs.*.result, 'failure') | |
&& !github.event.repository.fork | |
concurrency: | |
group: release-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.check-version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: "adopt" | |
- name: Produce coverage report | |
uses: DanySK/build-check-deploy-gradle-action@3.5.28 | |
with: | |
should-run-codecov: false | |
check-command: "./gradlew koverXmlReport --parallel || ./gradlew koverXmlReport --parallel" | |
- name: Push coverage report | |
uses: codecov/codecov-action@v5.1.2 | |
with: | |
files: ./build/reports/kover/report.xml | |
verbose: true | |
slug: zucchero-sintattico/piper-kt | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Install dependencies | |
run: npm install | |
- name: Avoid git hooks during release | |
run: rm -rf .git/hooks | |
- name: Run semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release | |
- name: Check version for release | |
id: check-version | |
shell: bash | |
run: | | |
GIT_VERSION=$(git describe --tags --exact-match HEAD || echo '') | |
if [ -n "$GIT_VERSION" ]; then | |
echo "version=$(echo $GIT_VERSION | sed 's/^v//')" >> "$GITHUB_OUTPUT" | |
fi | |
pages-deploy: | |
needs: release | |
if: >- | |
needs.release.result == 'success' | |
&& needs.release.outputs.version != '' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
env: | |
TMP_SITE: tmp-site | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- run: echo "Deploying version ${{ needs.release.outputs.version }} to GitHub Page" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod for Hugo | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: "adopt" | |
- name: Deploy to NPM | |
run: ./gradlew -Pversion=${{ needs.release.outputs.version }} :events:publishJsPackageToNpmjsRegistry --parallel | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Create artifacts directory | |
run: | | |
mkdir -p ${{ env.TMP_SITE }} | |
cp ./resources/index-github-pages.html ${{ env.TMP_SITE }}/index.html | |
- name: Build documentation | |
run: | | |
./gradlew -PforceVersion=${{ needs.release.outputs.version }} dokkaHtmlMultiModule --parallel | |
cp -r ./build/dokka/htmlMultiModule ${{ env.TMP_SITE }}/docs | |
- name: Build Open API documentation | |
run: | | |
./gradlew buildOpenApiSite --parallel | |
cp -r ./build/openapi-site ${{ env.TMP_SITE }}/openapi | |
cp -r ./resources/bdd-report ${{ env.TMP_SITE }}/bdd | |
cp -r ./resources/asyncapi-site ${{ env.TMP_SITE }}/asyncapi | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Build Site with Vitepress | |
working-directory: ./resources/report | |
run: | | |
npm ci | |
npm run docs:build -- --base /piper-kt/report/ --outDir ../../${{ env.TMP_SITE }}/report | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3.0.1 | |
with: | |
path: ${{ env.TMP_SITE }} | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4.0.5 | |
image-delivery: | |
name: ${{ matrix.service }} image delivery to Docker Hub | |
needs: release | |
if: >- | |
needs.release.result == 'success' | |
&& needs.release.outputs.version != '' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: | |
- "friendships-service" | |
- "frontend-service" | |
- "multimedia-service" | |
- "notifications-service" | |
- "servers-service" | |
- "users-service" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Produce Dockerfile for ${{ matrix.service }} | |
uses: DanySK/build-check-deploy-gradle-action@3.5.28 | |
with: | |
should-run-codecov: false | |
build-command: "./gradlew :${{ matrix.service }}:buildLayers && ./gradlew :${{ matrix.service }}:dockerfile" | |
check-command: ":" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push ${{ matrix.service }} image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ matrix.service }}/build/docker/main # path of Dockerfile generated by micronaut | |
push: true | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
tags: | | |
zuccherosintattico/piperkt-${{ matrix.service }}:${{ needs.release.outputs.version }} | |
zuccherosintattico/piperkt-${{ matrix.service }}:latest |