Skip to content

Commit 3d21918

Browse files
committed
Add sample build workflow
1 parent 61d9a30 commit 3d21918

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
backend-tests:
13+
name: Backend - Build and Test
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Set up JDK
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '23' # Update if using a different Java version
24+
distribution: 'openjdk'
25+
26+
- name: Cache Maven dependencies
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.m2
30+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
31+
restore-keys: |
32+
${{ runner.os }}-maven-
33+
34+
- name: Build and test backend
35+
run: |
36+
cd backend
37+
./mvnw clean install
38+
39+
frontend-tests:
40+
name: Frontend - Build and Test
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v3
46+
47+
- name: Set up Node.js
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: '22'
51+
52+
- name: Cache npm dependencies
53+
uses: actions/cache@v3
54+
with:
55+
path: ~/.npm
56+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
57+
restore-keys: |
58+
${{ runner.os }}-node-
59+
60+
- name: Install dependencies
61+
run: |
62+
cd frontend
63+
npm ci
64+
65+
- name: Run tests
66+
run: |
67+
npm run test -- --watch=false --no-progress
68+
69+
- name: Build frontend
70+
run: |
71+
npm run build -- --configuration production

0 commit comments

Comments
 (0)