69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
name: Java CI with Maven
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
checks: write
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKER_NET: "quarkus-it-net"
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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: Install dependencies with Proxy
|
|
env:
|
|
http_proxy: "http://host.docker.internal:3142"
|
|
https_proxy: "http://host.docker.internal:3142"
|
|
run: |
|
|
# Kiểm tra proxy có hoạt động không
|
|
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/80proxy
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends --no-install-suggests \
|
|
openjdk-25-jdk-headless docker-cli docker-buildx
|
|
|
|
- name: Build and Test all modules
|
|
env:
|
|
TESTCONTAINERS_RYUK_DISABLED: "true"
|
|
run: |
|
|
docker run -d --name postgres-it -p 5432:5432 -e POSTGRES_PASSWORD=password postgres || true
|
|
docker run -d --name redis-it -p 6379:6379 redis || true
|
|
|
|
./scripts/gen-it.sh
|
|
|
|
./mvnw -B verify \
|
|
-Dquarkus.container-image.push=false
|
|
|
|
- name: Debug Quarkus Integration Test Logs
|
|
if: failure()
|
|
run: |
|
|
echo "--- QUARKUS LOG ---"
|
|
# Tìm và hiển thị log của Quarkus Integration Test
|
|
find . -name "quarkus.log" -exec cat {} +
|
|
|
|
echo "--- DOCKER CONTAINERS STATUS ---"
|
|
docker ps -a
|
|
|
|
echo "--- DOCKER NETWORK INSPECT ---"
|
|
docker network inspect ${DOCKER_NET} || true |