Skip to content

Commit ff448ba

Browse files
authored
feat(tests): add GitHub Actions workflow for running tests (#64)
* feat(tests): add GitHub Actions workflow for running tests * feat(tests): add permissions for GitHub Actions workflow
1 parent 4b1e3e1 commit ff448ba

2 files changed

Lines changed: 57 additions & 3 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on:
2+
push:
3+
branches:
4+
- '**'
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
8+
permissions:
9+
contents: read
10+
11+
name: Tests
12+
jobs:
13+
tests:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up JDK 25
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: "temurin"
22+
java-version: 25
23+
overwrite-settings: false
24+
25+
- name: Cache Maven packages
26+
uses: actions/cache@v4
27+
with:
28+
path: ~/.m2/repository
29+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
30+
restore-keys: ${{ runner.os }}-maven
31+
32+
- name: Prepare test properties
33+
run: |
34+
mkdir -p src/test/resources
35+
echo ${{ secrets.APPLICATION_TEST_PROPERTIES }} | base64 -d > src/test/resources/application-test.properties
36+
echo "spring.sql.init.mode=never" >> src/test/resources/application-test.properties
37+
38+
- name: Prepare Docker .env for CI tests
39+
run: |
40+
cat > .env <<EOF
41+
POSTGRES_USER=${{ secrets.POSTGRES_USER }}
42+
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
43+
POSTGRES_DB=${{ secrets.POSTGRES_DB }}
44+
POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}
45+
EOF
46+
47+
- name: Install Docker Compose
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y docker-compose
51+
52+
- name: Run unit and integration tests
53+
run: ./mvnw clean verify

pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,17 @@
147147
<groupId>org.apache.maven.plugins</groupId>
148148
<artifactId>maven-surefire-plugin</artifactId>
149149
<configuration>
150-
<skip>true</skip>
150+
<excludes>
151+
<exclude>**/*IntegrationTest.java</exclude>
152+
</excludes>
151153
</configuration>
152154
</plugin>
153155
<plugin>
154156
<groupId>org.apache.maven.plugins</groupId>
155157
<artifactId>maven-failsafe-plugin</artifactId>
156158
<configuration>
157159
<includes>
158-
<include>**/*Tests.java</include>
159-
<include>**/*Test.java</include>
160+
<include>**/*IntegrationTest.java</include>
160161
</includes>
161162
</configuration>
162163
<executions>

0 commit comments

Comments
 (0)