chore(deps): update plugin io.spring.dependency-management to v1.1.7 … #2913
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: Java CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
REGISTRY_NAME: github.com | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
java-version: [21] | |
go-version: ["1.22.0"] | |
os: [ubuntu-latest] | |
# https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml | |
services: | |
postgres: | |
image: postgres:17 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: 123456 | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
redis: | |
image: redis:7.4.1-alpine | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps port 6379 on service container to the host | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
with: | |
submodules: recursive | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: ${{ matrix.java-version }} | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Run db migration | |
run: cd migration && go build -o migrate migration.go && ./migrate up | |
env: | |
POSTGRES_HOST: localhost | |
# POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port | |
POSTGRES_PORT: 5432 | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: 123456 | |
POSTGRES_DB: postgres | |
POSTGRES_SSLMODE: disable | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Unit Test with Gradle | |
# run: ./gradlew flywayMigrate && ./gradlew build | |
run: ./gradlew test | |
env: | |
CI: true | |
- name: Unit Test with Maven | |
# run: ./gradlew flywayMigrate && ./gradlew build | |
run: ./mvnw test && ./mvnw surefire-report:report-only | |
env: | |
CI: true | |
build: | |
runs-on: ${{ matrix.os }} | |
needs: [test] | |
strategy: | |
matrix: | |
java-version: [21, 22] | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: ${{ matrix.java-version }} | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build with Gradle | |
run: ./gradlew build -x test | |
build-maven: | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
strategy: | |
matrix: | |
java-version: [21] | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: ${{ matrix.java-version }} | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build with Maven | |
run: ./mvnw package -Dmaven.test.skip=true | |
build-docker: | |
runs-on: ubuntu-latest | |
needs: [build, build-maven] | |
steps: | |
- uses: actions/checkout@master | |
# Container build | |
- name: Build docker with gradle | |
id: build-docker-g | |
run: | | |
docker build . -t ${{ env.REGISTRY_NAME }}/damingerdai/hoteler-g:${{ github.sha }} -f Dockerfile | |
- name: Image digest for gradle | |
run: echo ${{ steps.build-docker-g.outputs.digest }} | |
- name: Build docker with maven | |
id: build-docker-m | |
run: | | |
docker build . -t ${{ env.REGISTRY_NAME }}/damingerdai/hoteler-m:${{ github.sha }} -f maven.Dockerfile | |
- name: Image digest for maven | |
run: echo ${{ steps.build-docker-m.outputs.digest }} | |
build-bazel: | |
runs-on: ${{ matrix.os }} | |
needs: [build] | |
strategy: | |
matrix: | |
java-version: [21] | |
os: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- uses: bazel-contrib/setup-bazel@0.10.0 | |
with: | |
# Avoid downloading Bazel every time. | |
bazelisk-cache: true | |
# Store build cache per workflow. | |
disk-cache: ${{ github.workflow }} | |
# Share repository cache between workflows. | |
repository-cache: true | |
- name: Build with bazel | |
run: bazel build //:hoteler | |