-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (62 loc) · 1.98 KB
/
Copy pathtesting_maven.yaml
File metadata and controls
72 lines (62 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Maven Tests
on:
workflow_call:
inputs:
java_version:
description: 'Java version to use (default: 17)'
required: false
type: string
default: '17'
jobs:
build:
name: Execute Maven Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for pom.xml
id: check_pom
run: |
if git ls-files "pom.xml" "**/pom.xml" | grep -q "."; then
echo "pom.xml found"
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "No pom.xml found"
echo "found=false" >> "$GITHUB_OUTPUT"
fi
- name: Install Xvfb
run: |
sudo apt-get update
sudo apt-get install -y xvfb
- name: Set up JDK
if: steps.check_pom.outputs.found == 'true'
uses: actions/setup-java@v2
with:
java-version: ${{ inputs.java_version }}
distribution: 'adopt'
settings-path: ${{ github.workspace }}
# woped main repo specific stuff
- uses: s4u/maven-settings-action@v2.5.0
with:
servers: '[{"id": "github","configuration": {"httpHeaders": {"property": {"name": "Authorization","value": "Bearer ${{ secrets.GITHUB_TOKEN }}"}}}}]'
# sometimes we need ui tests therefore we need to simulate a screen
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
sleep 2
- name: Cache Maven packages
if: steps.check_pom.outputs.found == 'true'
uses: actions/cache@v3
with:
path: ~/.m2
key: "${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}"
restore-keys: "${{ runner.os }}-m2"
- name: Build with Maven
if: steps.check_pom.outputs.found == 'true'
env:
DISPLAY: :99
run: mvn -B clean install
- name: Run tests
if: steps.check_pom.outputs.found == 'true'
env:
DISPLAY: :99
run: mvn test