-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 1.89 KB
/
build_and_test_javalin.yml
File metadata and controls
62 lines (54 loc) · 1.89 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
# This workflow builds and tests the Javalin Shopping sample
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
name: Javalin Shopping sample
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "**" ]
workflow_dispatch: # Allow manual triggering
jobs:
detect-changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.changed.outputs.any_modified }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect changed files
id: changed
uses: tj-actions/changed-files@v46
with:
files: |
ams-javalin-shopping/pom.xml
ams-javalin-shopping/src/**
.github/workflows/build_and_test_javalin.yml
maven:
name: Build and Test
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
cache-dependency-path: ams-javalin-shopping/pom.xml
- name: Build and Test
run: mvn clean test
working-directory: ams-javalin-shopping
# This job ensures the workflow passes when no relevant changes are detected
# Required for PR status checks to pass when the sample hasn't changed
no-changes:
name: Build and Test
needs: detect-changes
if: ${{ github.event_name != 'workflow_dispatch' && needs.detect-changes.outputs.should_run != 'true' }}
runs-on: ubuntu-latest
steps:
- name: No relevant changes detected
run: echo "No relevant changes detected for ams-javalin-shopping. Skipping build and test."