|
1 | 1 | name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [main, dev, shift] |
6 | | - pull_request: |
7 | | - branches: [main, dev] |
| 4 | + push: |
| 5 | + branches: [main, dev, shift] |
| 6 | + pull_request: |
| 7 | + branches: [main, dev] |
8 | 8 |
|
9 | 9 | # Cancel redundant runs when a new push is made to the same branch |
10 | 10 | concurrency: |
11 | | - group: ${{ github.workflow }}-${{ github.ref }} |
12 | | - cancel-in-progress: true |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
13 | 13 |
|
14 | 14 | jobs: |
15 | | - frontend: |
16 | | - name: Frontend (Lint & Build) |
17 | | - runs-on: ubuntu-latest |
18 | | - |
19 | | - defaults: |
20 | | - run: |
21 | | - working-directory: frontend |
22 | | - |
23 | | - steps: |
24 | | - - name: Checkout code |
25 | | - uses: actions/checkout@v4 |
26 | | - |
27 | | - - name: Setup Node.js 20 |
28 | | - uses: actions/setup-node@v4 |
29 | | - with: |
30 | | - node-version: "20" |
31 | | - cache: "npm" |
32 | | - cache-dependency-path: frontend/package-lock.json |
33 | | - |
34 | | - - name: Install dependencies |
35 | | - run: npm ci |
36 | | - |
37 | | - - name: Lint |
38 | | - run: npm run lint:ci |
39 | | - |
40 | | - - name: Build |
41 | | - run: npm run build |
42 | | - |
43 | | - - name: Upload build artifact |
44 | | - uses: actions/upload-artifact@v4 |
45 | | - with: |
46 | | - name: frontend-dist |
47 | | - path: frontend/dist |
48 | | - retention-days: 7 |
49 | | - |
50 | | - backend: |
51 | | - name: Backend (Build & Test) |
52 | | - runs-on: ubuntu-latest |
53 | | - |
54 | | - defaults: |
55 | | - run: |
56 | | - working-directory: backend |
57 | | - |
58 | | - services: |
59 | | - mysql: |
60 | | - image: mysql:8.0 |
61 | | - env: |
62 | | - MYSQL_ROOT_PASSWORD: test1234 |
63 | | - MYSQL_DATABASE: smalltrend_test |
64 | | - ports: |
65 | | - - 3306:3306 |
66 | | - options: >- |
67 | | - --health-cmd="mysqladmin ping -h localhost" |
68 | | - --health-interval=10s |
69 | | - --health-timeout=5s |
70 | | - --health-retries=5 |
71 | | - |
72 | | - env: |
73 | | - DB_URL: jdbc:mysql://localhost:3306/smalltrend_test?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC&createDatabaseIfNotExist=true |
74 | | - DB_USERNAME: root |
75 | | - DB_PASSWORD: test1234 |
76 | | - JWT_SECRET: 5367566B59703373367639792F423F4528482B4D6251655468576D5A71347437 |
77 | | - CLOUDINARY_CLOUD_NAME: ci_dummy |
78 | | - CLOUDINARY_API_KEY: "000000000000000" |
79 | | - CLOUDINARY_API_SECRET: ci_dummy_secret |
80 | | - SPRING_SQL_INIT_MODE: never |
81 | | - SPRING_JPA_DDL_AUTO: create-drop |
82 | | - |
83 | | - steps: |
84 | | - - name: Checkout code |
85 | | - uses: actions/checkout@v4 |
86 | | - |
87 | | - - name: Setup Java 17 |
88 | | - uses: actions/setup-java@v4 |
89 | | - with: |
90 | | - java-version: "17" |
91 | | - distribution: "temurin" |
92 | | - cache: "maven" |
93 | | - |
94 | | - - name: Make Maven wrapper executable |
95 | | - run: chmod +x mvnw |
96 | | - |
97 | | - - name: Compile (skip tests) |
98 | | - run: ./mvnw -B compile -DskipTests |
99 | | - |
100 | | - - name: Run tests + JaCoCo coverage |
101 | | - run: ./mvnw -B verify |
102 | | - |
103 | | - - name: Upload JaCoCo coverage report |
104 | | - if: always() |
105 | | - uses: actions/upload-artifact@v4 |
106 | | - with: |
107 | | - name: jacoco-report |
108 | | - path: backend/target/site/jacoco |
109 | | - retention-days: 7 |
110 | | - |
111 | | - - name: Upload JUnit test results |
112 | | - if: always() |
113 | | - uses: actions/upload-artifact@v4 |
114 | | - with: |
115 | | - name: junit-test-results |
116 | | - path: backend/target/surefire-reports |
117 | | - retention-days: 7 |
| 15 | + frontend: |
| 16 | + name: Frontend (Lint & Build) |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + defaults: |
| 20 | + run: |
| 21 | + working-directory: frontend |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Setup Node.js 20 |
| 28 | + uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: "20" |
| 31 | + cache: "npm" |
| 32 | + cache-dependency-path: frontend/package-lock.json |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: npm ci |
| 36 | + |
| 37 | + - name: Lint |
| 38 | + run: npm run lint:ci |
| 39 | + |
| 40 | + - name: Build |
| 41 | + run: npm run build |
| 42 | + |
| 43 | + - name: Upload build artifact |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: frontend-dist |
| 47 | + path: frontend/dist |
| 48 | + retention-days: 7 |
| 49 | + |
| 50 | + backend: |
| 51 | + name: Backend (Build & Test) |
| 52 | + runs-on: ubuntu-latest |
| 53 | + |
| 54 | + defaults: |
| 55 | + run: |
| 56 | + working-directory: backend |
| 57 | + |
| 58 | + services: |
| 59 | + mysql: |
| 60 | + image: mysql:8.0 |
| 61 | + env: |
| 62 | + MYSQL_ROOT_PASSWORD: test1234 |
| 63 | + MYSQL_DATABASE: smalltrend_test |
| 64 | + ports: |
| 65 | + - 3306:3306 |
| 66 | + options: >- |
| 67 | + --health-cmd="mysqladmin ping -h localhost" |
| 68 | + --health-interval=10s |
| 69 | + --health-timeout=5s |
| 70 | + --health-retries=5 |
| 71 | +
|
| 72 | + env: |
| 73 | + DB_URL: jdbc:mysql://localhost:3306/smalltrend_test?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC&createDatabaseIfNotExist=true |
| 74 | + DB_USERNAME: root |
| 75 | + DB_PASSWORD: test1234 |
| 76 | + JWT_SECRET: 5367566B59703373367639792F423F4528482B4D6251655468576D5A71347437 |
| 77 | + CLOUDINARY_CLOUD_NAME: ci_dummy |
| 78 | + CLOUDINARY_API_KEY: "000000000000000" |
| 79 | + CLOUDINARY_API_SECRET: ci_dummy_secret |
| 80 | + SPRING_SQL_INIT_MODE: never |
| 81 | + SPRING_JPA_DDL_AUTO: create-drop |
| 82 | + |
| 83 | + steps: |
| 84 | + - name: Checkout code |
| 85 | + uses: actions/checkout@v4 |
| 86 | + |
| 87 | + - name: Setup Java 17 |
| 88 | + uses: actions/setup-java@v4 |
| 89 | + with: |
| 90 | + java-version: "17" |
| 91 | + distribution: "temurin" |
| 92 | + cache: "maven" |
| 93 | + |
| 94 | + - name: Make Maven wrapper executable |
| 95 | + run: chmod +x mvnw |
| 96 | + |
| 97 | + - name: Compile (skip tests) |
| 98 | + run: ./mvnw -B compile -DskipTests |
| 99 | + |
| 100 | + - name: Run tests + JaCoCo coverage |
| 101 | + run: ./mvnw -B verify |
| 102 | + |
| 103 | + - name: Upload JaCoCo coverage report |
| 104 | + if: always() |
| 105 | + uses: actions/upload-artifact@v4 |
| 106 | + with: |
| 107 | + name: jacoco-report |
| 108 | + path: backend/target/site/jacoco |
| 109 | + retention-days: 7 |
| 110 | + |
| 111 | + - name: Upload JUnit test results |
| 112 | + if: always() |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: junit-test-results |
| 116 | + path: backend/target/surefire-reports |
| 117 | + retention-days: 7 |
0 commit comments