ci - 워크플로 정비 및 단위테스트 안정화
- Gitea Generic Package 업로드 단계 추가 - 단위테스트, e2e 워크플로 분리 - systemd 유닛 동기화 단계 제거 - checkout step 이름·주석 정리 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,12 +23,14 @@ jobs:
|
||||
working-directory: eapim-portal
|
||||
|
||||
steps:
|
||||
- name: Checkout eapim-portal (trigger SHA)
|
||||
- name: Checkout eapim-portal (this branch)
|
||||
# ref 미지정 — 트리거된 브랜치/commit(github.sha) 그대로 빌드.
|
||||
uses: http://172.30.1.50:3000/actions/checkout@v4
|
||||
with:
|
||||
path: eapim-portal
|
||||
|
||||
- name: Checkout elink-portal-common (master)
|
||||
- name: Checkout elink-portal-common (master, dependency)
|
||||
# 의존 모듈은 항상 master 고정.
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
rm -rf elink-portal-common
|
||||
@@ -36,7 +38,8 @@ jobs:
|
||||
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-portal-common.git \
|
||||
elink-portal-common
|
||||
|
||||
- name: Checkout elink-online-core-jpa (master)
|
||||
- name: Checkout elink-online-core-jpa (master, dependency)
|
||||
# 의존 모듈은 항상 master 고정.
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
mkdir -p eapim-online
|
||||
@@ -62,6 +65,40 @@ jobs:
|
||||
eapim-portal/build/libs/eapim-portal-boot.war
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Publish WAR to Gitea Generic Package
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
GITEA_URL: http://172.30.1.50:3000
|
||||
PKG_OWNER: djb-eapim
|
||||
PKG_NAME: eapim-portal
|
||||
run: |
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
VERSION="$(TZ=Asia/Seoul date +%Y-%m-%d-%H%M)-${SHORT_SHA}"
|
||||
BASE="$GITEA_URL/api/packages/$PKG_OWNER/generic/$PKG_NAME/$VERSION"
|
||||
|
||||
echo "package version: $VERSION"
|
||||
echo "endpoint base : $BASE"
|
||||
|
||||
for WAR in eapim-portal.war eapim-portal-boot.war; do
|
||||
SRC="eapim-portal/build/libs/$WAR"
|
||||
if [ ! -f "$SRC" ]; then
|
||||
echo "::error::missing artifact: $SRC"
|
||||
exit 1
|
||||
fi
|
||||
HTTP=$(curl -sS -o "/tmp/pkg-upload-$WAR.log" -w '%{http_code}' \
|
||||
--user "oauth2:${{ secrets.CI_TOKEN }}" \
|
||||
--upload-file "$SRC" \
|
||||
"$BASE/$WAR")
|
||||
if [ "$HTTP" != "201" ] && [ "$HTTP" != "200" ]; then
|
||||
echo "::error::upload failed for $WAR (HTTP $HTTP)"
|
||||
cat "/tmp/pkg-upload-$WAR.log" || true
|
||||
exit 1
|
||||
fi
|
||||
echo " uploaded: $WAR (HTTP $HTTP)"
|
||||
done
|
||||
|
||||
echo "published: $GITEA_URL/$PKG_OWNER/-/packages/generic/$PKG_NAME/$VERSION"
|
||||
|
||||
- name: Stop tomcat (pre-clean)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
@@ -86,15 +123,6 @@ jobs:
|
||||
cp eapim-portal/build/libs/eapim-portal.war "$DEPLOY_DIR/ROOT.war"
|
||||
ls -la "$DEPLOY_DIR"
|
||||
|
||||
- name: Refresh systemd unit
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
# repo 의 unit 파일을 사용자 systemd 디렉터리로 sync (정의 변경 자동 반영)
|
||||
install -m 0644 \
|
||||
eapim-portal/deploy/systemd/eapim-portal.service \
|
||||
"$HOME/.config/systemd/user/eapim-portal.service"
|
||||
systemctl --user daemon-reload
|
||||
|
||||
- name: Start tomcat and readiness probe (timeout 120s)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
name: eapim-portal E2E Test
|
||||
|
||||
# 수동 트리거 전용. e2e 태그가 붙은 Selenium/통합 테스트만 실행.
|
||||
# 요구 인프라:
|
||||
# - Chrome + libgbm/libxkbcommon-x11 (Selenium 4종)
|
||||
# - Oracle JDBC 또는 testcontainers (SignupFileTest)
|
||||
# 미설치 환경에서는 SessionNotCreated/DB 에러로 일부 케이스가 실패할 수 있음.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
runs-on: [self-hosted, linux, eapim-portal]
|
||||
env:
|
||||
JAVA_HOME: /apps/opts/jdk8
|
||||
defaults:
|
||||
run:
|
||||
working-directory: eapim-portal
|
||||
|
||||
steps:
|
||||
- name: Checkout eapim-portal (this branch)
|
||||
uses: http://172.30.1.50:3000/actions/checkout@v4
|
||||
with:
|
||||
path: eapim-portal
|
||||
|
||||
- name: Checkout elink-portal-common (master, dependency)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
rm -rf elink-portal-common
|
||||
git clone --depth=1 --branch master \
|
||||
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-portal-common.git \
|
||||
elink-portal-common
|
||||
|
||||
- name: Checkout elink-online-core-jpa (master, dependency)
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
mkdir -p eapim-online
|
||||
rm -rf eapim-online/elink-online-core-jpa
|
||||
git clone --depth=1 --branch master \
|
||||
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-online-core-jpa.git \
|
||||
eapim-online/elink-online-core-jpa
|
||||
|
||||
- name: Verify toolchain
|
||||
run: |
|
||||
java -version
|
||||
gradle --version
|
||||
|
||||
- name: Gradle e2e test
|
||||
run: gradle test --no-daemon -PincludeE2E=true
|
||||
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: http://172.30.1.50:3000/actions/upload-artifact@v3
|
||||
with:
|
||||
name: eapim-portal-e2e-${{ github.sha }}
|
||||
path: |
|
||||
eapim-portal/build/reports/tests/test/
|
||||
eapim-portal/build/test-results/test/
|
||||
if-no-files-found: warn
|
||||
@@ -0,0 +1,63 @@
|
||||
name: eapim-portal Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- stage
|
||||
- feats/ci-test
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: [self-hosted, linux, eapim-portal]
|
||||
env:
|
||||
JAVA_HOME: /apps/opts/jdk8
|
||||
defaults:
|
||||
run:
|
||||
working-directory: eapim-portal
|
||||
|
||||
steps:
|
||||
- name: Checkout eapim-portal (this branch)
|
||||
# ref 미지정 — 트리거된 브랜치/commit(github.sha) 그대로 빌드.
|
||||
uses: http://172.30.1.50:3000/actions/checkout@v4
|
||||
with:
|
||||
path: eapim-portal
|
||||
|
||||
- name: Checkout elink-portal-common (master, dependency)
|
||||
# 의존 모듈은 항상 master 고정.
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
rm -rf elink-portal-common
|
||||
git clone --depth=1 --branch master \
|
||||
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-portal-common.git \
|
||||
elink-portal-common
|
||||
|
||||
- name: Checkout elink-online-core-jpa (master, dependency)
|
||||
# 의존 모듈은 항상 master 고정.
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
mkdir -p eapim-online
|
||||
rm -rf eapim-online/elink-online-core-jpa
|
||||
git clone --depth=1 --branch master \
|
||||
http://oauth2:${{ secrets.CI_TOKEN }}@172.30.1.50:3000/djb-eapim/elink-online-core-jpa.git \
|
||||
eapim-online/elink-online-core-jpa
|
||||
|
||||
- name: Verify toolchain
|
||||
run: |
|
||||
java -version
|
||||
gradle --version
|
||||
|
||||
- name: Gradle test
|
||||
run: gradle test --no-daemon
|
||||
|
||||
- name: Upload test results
|
||||
# 실패해도 결과 리포트는 올려서 원인 분석 가능하게.
|
||||
if: always()
|
||||
uses: http://172.30.1.50:3000/actions/upload-artifact@v3
|
||||
with:
|
||||
name: eapim-portal-test-${{ github.sha }}
|
||||
path: |
|
||||
eapim-portal/build/reports/tests/test/
|
||||
eapim-portal/build/test-results/test/
|
||||
if-no-files-found: warn
|
||||
Reference in New Issue
Block a user