|
1 | 1 | name: Java CI with Maven
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: "main" |
6 |
| - pull_request: |
7 |
| - branches: "*" |
| 4 | + push: |
| 5 | + branches: "main" |
| 6 | + pull_request: |
| 7 | + branches: "*" |
8 | 8 |
|
9 | 9 | jobs:
|
10 |
| - build: |
11 |
| - runs-on: ubuntu-latest |
12 |
| - steps: |
13 |
| - - uses: actions/checkout@v4 |
14 |
| - - name: Set up Node 22 |
15 |
| - uses: actions/setup-node@v4 |
16 |
| - with: |
17 |
| - node-version: '22.x' |
18 |
| - cache: 'npm' |
19 |
| - cache-dependency-path: ui/package-lock.json |
20 |
| - - name: Set up JDK 21 |
21 |
| - uses: actions/setup-java@v4 |
22 |
| - with: |
23 |
| - java-version: '21' |
24 |
| - distribution: 'temurin' |
25 |
| - cache: maven |
26 |
| - - name: Build with Maven |
27 |
| - run: mvn -B install --file pom.xml |
28 |
| - - name: PMD with Maven |
29 |
| - run: mvn pmd:pmd --file pom.xml |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Set up Node 22 |
| 15 | + uses: actions/setup-node@v4 |
| 16 | + with: |
| 17 | + node-version: "22.x" |
| 18 | + cache: "npm" |
| 19 | + cache-dependency-path: ui/package-lock.json |
| 20 | + - name: Set up JDK 21 |
| 21 | + uses: actions/setup-java@v4 |
| 22 | + with: |
| 23 | + java-version: "21" |
| 24 | + distribution: "temurin" |
| 25 | + cache: maven |
| 26 | + - name: Build with Maven |
| 27 | + run: mvn -B install --file pom.xml |
| 28 | + - name: PMD with Maven |
| 29 | + run: mvn pmd:pmd --file pom.xml |
30 | 30 |
|
31 |
| - test-mssql: |
32 |
| - runs-on: ubuntu-latest |
33 |
| - needs: build |
34 |
| - services: |
35 |
| - sql-edge: |
36 |
| - image: mcr.microsoft.com/azure-sql-edge |
37 |
| - options: --cap-add SYS_PTRACE --name azuresqledge |
38 |
| - env: |
39 |
| - ACCEPT_EULA: Y |
40 |
| - MSSQL_SA_PASSWORD: "veryStrong123" |
41 |
| - ports: |
42 |
| - - 1433:1433 |
43 |
| - steps: |
44 |
| - - uses: actions/checkout@v4 |
45 |
| - - name: Set up JDK 21 |
46 |
| - uses: actions/setup-java@v4 |
47 |
| - with: |
48 |
| - java-version: '21' |
49 |
| - distribution: 'temurin' |
50 |
| - cache: maven |
51 |
| - - name: Run tests with MSSQL |
52 |
| - run: mvn test -pl core -am -Dspring.profiles.active=mssql |
| 31 | + test-mssql: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + needs: build |
| 34 | + services: |
| 35 | + sql-edge: |
| 36 | + image: mcr.microsoft.com/azure-sql-edge |
| 37 | + options: --cap-add SYS_PTRACE --name azuresqledge |
| 38 | + env: |
| 39 | + ACCEPT_EULA: Y |
| 40 | + MSSQL_SA_PASSWORD: "veryStrong123" |
| 41 | + ports: |
| 42 | + - 1433:1433 |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + - name: Set up JDK 21 |
| 46 | + uses: actions/setup-java@v4 |
| 47 | + with: |
| 48 | + java-version: "21" |
| 49 | + distribution: "temurin" |
| 50 | + cache: maven |
| 51 | + - name: Run tests with MSSQL |
| 52 | + run: mvn test -pl core -am -Dspring.profiles.active=mssql |
53 | 53 |
|
54 |
| - test-postgres: |
55 |
| - runs-on: ubuntu-latest |
56 |
| - needs: build |
57 |
| - services: |
58 |
| - postgres: |
59 |
| - image: postgres |
60 |
| - options: --name pg-container |
61 |
| - env: |
62 |
| - POSTGRES_USER: sa |
63 |
| - POSTGRES_PASSWORD: veryStrong123 |
64 |
| - ports: |
65 |
| - - 5432:5432 |
66 |
| - steps: |
67 |
| - - uses: actions/checkout@v4 |
68 |
| - - name: Set up JDK 21 |
69 |
| - uses: actions/setup-java@v4 |
70 |
| - with: |
71 |
| - java-version: '21' |
72 |
| - distribution: 'temurin' |
73 |
| - cache: maven |
74 |
| - - name: Run tests with postgres |
75 |
| - run: mvn test -pl core -am -Dspring.profiles.active=postgres |
| 54 | + test-mssql-virtual: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + needs: build |
| 57 | + services: |
| 58 | + sql-edge: |
| 59 | + image: mcr.microsoft.com/azure-sql-edge |
| 60 | + options: --cap-add SYS_PTRACE --name azuresqledge |
| 61 | + env: |
| 62 | + ACCEPT_EULA: Y |
| 63 | + MSSQL_SA_PASSWORD: "veryStrong123" |
| 64 | + ports: |
| 65 | + - 1433:1433 |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v4 |
| 68 | + - name: Set up JDK 21 |
| 69 | + uses: actions/setup-java@v4 |
| 70 | + with: |
| 71 | + java-version: "21" |
| 72 | + distribution: "temurin" |
| 73 | + cache: maven |
| 74 | + - name: Run tests with MSSQL |
| 75 | + run: mvn test -pl core -am -Dspring.profiles.active=mssql,virtual-thread |
76 | 76 |
|
77 |
| - test-mariadb: |
78 |
| - runs-on: ubuntu-latest |
79 |
| - needs: build |
80 |
| - services: |
81 |
| - postgres: |
82 |
| - image: mariadb:latest |
83 |
| - env: |
84 |
| - MYSQL_USER: sa |
85 |
| - MYSQL_ROOT_PASSWORD: veryStrong123 |
86 |
| - MYSQL_PASSWORD: veryStrong123 |
87 |
| - MYSQL_DATABASE: testdb |
88 |
| - ports: |
89 |
| - - 3306:3306 |
90 |
| - steps: |
91 |
| - - uses: actions/checkout@v4 |
92 |
| - - name: Set up JDK 21 |
93 |
| - uses: actions/setup-java@v4 |
94 |
| - with: |
95 |
| - java-version: '21' |
96 |
| - distribution: 'temurin' |
97 |
| - cache: maven |
98 |
| - - name: Run tests with mariadb |
99 |
| - run: mvn test -pl core -am -Dspring.profiles.active=mariadb |
| 77 | + test-postgres: |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: build |
| 80 | + services: |
| 81 | + postgres: |
| 82 | + image: postgres |
| 83 | + options: --name pg-container |
| 84 | + env: |
| 85 | + POSTGRES_USER: sa |
| 86 | + POSTGRES_PASSWORD: veryStrong123 |
| 87 | + ports: |
| 88 | + - 5432:5432 |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + - name: Set up JDK 21 |
| 92 | + uses: actions/setup-java@v4 |
| 93 | + with: |
| 94 | + java-version: "21" |
| 95 | + distribution: "temurin" |
| 96 | + cache: maven |
| 97 | + - name: Run tests with postgres |
| 98 | + run: mvn test -pl core -am -Dspring.profiles.active=postgres |
100 | 99 |
|
101 |
| - java-doc: |
102 |
| - runs-on: ubuntu-latest |
103 |
| - needs: [build] |
104 |
| - if: ${{ github.ref == 'refs/heads/main' }} |
105 |
| - permissions: |
106 |
| - contents: write # if you have a protection rule on your repository, you'll need to give write permission to the workflow. |
107 |
| - steps: |
108 |
| - - uses: actions/checkout@v4 |
109 |
| - - name: Set up Node 22 |
110 |
| - uses: actions/setup-node@v4 |
111 |
| - with: |
112 |
| - node-version: '22.x' |
113 |
| - cache: 'npm' |
114 |
| - cache-dependency-path: ui/package-lock.json |
115 |
| - - name: Set up JDK 21 |
116 |
| - uses: actions/setup-java@v4 |
117 |
| - with: |
118 |
| - java-version: '21' |
119 |
| - distribution: 'temurin' |
120 |
| - cache: maven |
121 |
| - - name: Deploy JavaDoc 🚀 |
122 |
| - uses: MathieuSoysal/Javadoc-publisher.yml@v2.5.0 |
123 |
| - with: |
124 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
125 |
| - javadoc-branch: javadoc |
126 |
| - java-version: 21 |
127 |
| - target-folder: javadoc-core # url will be https://<username>.github.io/<repo>/javadoc-core |
128 |
| - project: maven # or gradle |
| 100 | + test-postgres-virtual: |
| 101 | + runs-on: ubuntu-latest |
| 102 | + needs: build |
| 103 | + services: |
| 104 | + postgres: |
| 105 | + image: postgres |
| 106 | + options: --name pg-container |
| 107 | + env: |
| 108 | + POSTGRES_USER: sa |
| 109 | + POSTGRES_PASSWORD: veryStrong123 |
| 110 | + ports: |
| 111 | + - 5432:5432 |
| 112 | + steps: |
| 113 | + - uses: actions/checkout@v4 |
| 114 | + - name: Set up JDK 21 |
| 115 | + uses: actions/setup-java@v4 |
| 116 | + with: |
| 117 | + java-version: "21" |
| 118 | + distribution: "temurin" |
| 119 | + cache: maven |
| 120 | + - name: Run tests with postgres |
| 121 | + run: mvn test -pl core -am -Dspring.profiles.active=postgres,virtual-thread |
129 | 122 |
|
130 |
| - maven-deploy: |
131 |
| - runs-on: ubuntu-latest |
132 |
| - needs: [build, test-mssql, test-postgres, test-mariadb] |
133 |
| - if: ${{ github.ref == 'refs/heads/main' }} |
134 |
| - steps: |
135 |
| - - uses: actions/checkout@v4 |
136 |
| - - name: Set up Node 22 |
137 |
| - uses: actions/setup-node@v4 |
138 |
| - with: |
139 |
| - node-version: '22.x' |
140 |
| - cache: 'npm' |
141 |
| - cache-dependency-path: ui/package-lock.json |
142 |
| - - name: Set up JDK 21 |
143 |
| - uses: actions/setup-java@v4 |
144 |
| - with: |
145 |
| - java-version: '21' |
146 |
| - distribution: 'temurin' |
147 |
| - cache: maven |
148 |
| - server-id: ossrh |
149 |
| - server-username: MAVEN_USERNAME |
150 |
| - server-password: MAVEN_PASSWORD |
151 |
| - - name: Deploy Nexus |
152 |
| - run: mvn -B source:jar javadoc:jar deploy --file pom.xml -DskipTests |
153 |
| - env: |
154 |
| - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
155 |
| - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
| 123 | + test-mariadb: |
| 124 | + runs-on: ubuntu-latest |
| 125 | + needs: build |
| 126 | + services: |
| 127 | + postgres: |
| 128 | + image: mariadb:latest |
| 129 | + env: |
| 130 | + MYSQL_USER: sa |
| 131 | + MYSQL_ROOT_PASSWORD: veryStrong123 |
| 132 | + MYSQL_PASSWORD: veryStrong123 |
| 133 | + MYSQL_DATABASE: testdb |
| 134 | + ports: |
| 135 | + - 3306:3306 |
| 136 | + steps: |
| 137 | + - uses: actions/checkout@v4 |
| 138 | + - name: Set up JDK 21 |
| 139 | + uses: actions/setup-java@v4 |
| 140 | + with: |
| 141 | + java-version: "21" |
| 142 | + distribution: "temurin" |
| 143 | + cache: maven |
| 144 | + - name: Run tests with mariadb |
| 145 | + run: mvn test -pl core -am -Dspring.profiles.active=mariadb |
| 146 | + |
| 147 | + all-tests: |
| 148 | + runs-on: ubuntu-latest |
| 149 | + needs: [test-mssql, test-mssql-virtual, test-mariadb, test-postgres, test-postgres-virtual] |
| 150 | + steps: |
| 151 | + - name: All test done |
| 152 | + run: echo "All test succeeded." |
| 153 | + |
| 154 | + java-doc: |
| 155 | + runs-on: ubuntu-latest |
| 156 | + needs: all-tests |
| 157 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 158 | + permissions: |
| 159 | + contents: write # if you have a protection rule on your repository, you'll need to give write permission to the workflow. |
| 160 | + steps: |
| 161 | + - uses: actions/checkout@v4 |
| 162 | + - name: Set up Node 22 |
| 163 | + uses: actions/setup-node@v4 |
| 164 | + with: |
| 165 | + node-version: "22.x" |
| 166 | + cache: "npm" |
| 167 | + cache-dependency-path: ui/package-lock.json |
| 168 | + - name: Set up JDK 21 |
| 169 | + uses: actions/setup-java@v4 |
| 170 | + with: |
| 171 | + java-version: "21" |
| 172 | + distribution: "temurin" |
| 173 | + cache: maven |
| 174 | + - name: Deploy JavaDoc 🚀 |
| 175 | + uses: MathieuSoysal/Javadoc-publisher.yml@v2.5.0 |
| 176 | + with: |
| 177 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 178 | + javadoc-branch: javadoc |
| 179 | + java-version: 21 |
| 180 | + target-folder: javadoc-core # url will be https://<username>.github.io/<repo>/javadoc-core |
| 181 | + project: maven # or gradle |
| 182 | + |
| 183 | + maven-deploy: |
| 184 | + runs-on: ubuntu-latest |
| 185 | + needs: all-tests |
| 186 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 187 | + steps: |
| 188 | + - uses: actions/checkout@v4 |
| 189 | + - name: Set up Node 22 |
| 190 | + uses: actions/setup-node@v4 |
| 191 | + with: |
| 192 | + node-version: "22.x" |
| 193 | + cache: "npm" |
| 194 | + cache-dependency-path: ui/package-lock.json |
| 195 | + - name: Set up JDK 21 |
| 196 | + uses: actions/setup-java@v4 |
| 197 | + with: |
| 198 | + java-version: "21" |
| 199 | + distribution: "temurin" |
| 200 | + cache: maven |
| 201 | + server-id: ossrh |
| 202 | + server-username: MAVEN_USERNAME |
| 203 | + server-password: MAVEN_PASSWORD |
| 204 | + - name: Deploy Nexus |
| 205 | + run: mvn -B source:jar javadoc:jar deploy --file pom.xml -DskipTests |
| 206 | + env: |
| 207 | + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
| 208 | + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
0 commit comments