From ef44688e907b5b44bab742958bd687a7014f68ed Mon Sep 17 00:00:00 2001 From: itkhair05 Date: Wed, 14 Oct 2026 18:19:57 +0700 Subject: [PATCH] ci: add GitHub Actions workflow for backend tests and frontend lint+build --- .github/copilot-instructions.md | 0 .github/workflows/ci.yml | 82 +++++++++++++++++++++++++++++++++ .gitignore | 2 +- README.md | 2 + 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .github/copilot-instructions.md create mode 100644 .github/workflows/ci.yml diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..842c226 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,82 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + backend: + name: Backend Tests + runs-on: ubuntu-latest + + services: + mysql: + image: mysql:8.4 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: jobtrack_test + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -h localhost" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + env: + SPRING_PROFILES_ACTIVE: dev + DB_URL: jdbc:mysql://127.0.0.1:3306/jobtrack_test?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC + DB_USERNAME: root + DB_PASSWORD: root + JWT_SECRET: test-secret-key-at-least-32-characters-long-for-testing-only + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + cache-dependency-path: backend/pom.xml + + - name: Run Maven tests + working-directory: backend + run: | + chmod +x ./mvnw + ./mvnw test + + frontend: + name: Frontend Lint & Build + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + working-directory: frontend + run: npm ci + + - name: Run lint + working-directory: frontend + run: npm run lint + + - name: Run build + working-directory: frontend + run: npm run build diff --git a/.gitignore b/.gitignore index ed47f72..e76bc14 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,4 @@ backend/uploads/cvs/ .trae/ .continue/ .codebuddy/ -.github/ \ No newline at end of file +.github/prompts/ \ No newline at end of file diff --git a/README.md b/README.md index 23b9364..0cb2b10 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # JobTrack +[![CI](https://github.com/itkhair05/Jobtrack-System/actions/workflows/ci.yml/badge.svg)](https://github.com/itkhair05/Jobtrack-System/actions/workflows/ci.yml) + Công cụ theo dõi quá trình ứng tuyển việc làm full-stack, hỗ trợ quản lý toàn bộ vòng đời ứng tuyển từ giai đoạn lưu trữ hồ sơ đến khi nhận việc. ![Java](https://img.shields.io/badge/Java-17-orange?logo=openjdk&logoColor=white)