Skip to content

Commit 346b2b6

Browse files
Simplify copilot-setup-steps.yml to use actions/setup-java like other workflows
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 3763276 commit 346b2b6

1 file changed

Lines changed: 28 additions & 96 deletions

File tree

.github/copilot-setup-steps.yml

Lines changed: 28 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -3,76 +3,42 @@
33
# See: https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
44

55
steps:
6-
# Step 1: Install SDKMAN (Java version manager)
7-
- name: Install SDKMAN
8-
shell: bash
9-
run: |
10-
# Install SDKMAN if not already installed
11-
if [ ! -d "$HOME/.sdkman" ]; then
12-
curl -s "https://get.sdkman.io" | bash
13-
source "$HOME/.sdkman/bin/sdkman-init.sh"
14-
else
15-
source "$HOME/.sdkman/bin/sdkman-init.sh"
16-
fi
17-
18-
# Verify SDKMAN installation
19-
sdk version
6+
# Step 1: Set up Java 25 using the setup-java action
7+
- name: Set up JDK 25
8+
uses: actions/setup-java@v5
9+
with:
10+
java-version: "25"
11+
distribution: "temurin"
12+
cache: maven
2013
notes: |
21-
SDKMAN is a tool for managing parallel versions of multiple Software Development Kits.
22-
It's used to install and manage Java versions on Unix-based systems.
23-
24-
OS-specific notes:
25-
- Linux/macOS: Works out of the box
26-
- Windows: Use WSL (Windows Subsystem for Linux) or Git Bash
27-
- Windows alternative: Download Java 25 directly from https://adoptium.net/temurin/releases/
28-
29-
# Step 2: Install Java 25 using SDKMAN
30-
- name: Install Java 25
31-
shell: bash
32-
run: |
33-
# Source SDKMAN
34-
source "$HOME/.sdkman/bin/sdkman-init.sh"
35-
36-
# Install Java 25 (Temurin distribution)
37-
# The exact version identifier may vary by platform
38-
sdk install java 25.0.1-tem || sdk install java 25.0.0-tem || sdk install java 25-tem
39-
40-
# Set Java 25 as the default version for this shell
41-
sdk use java 25.0.1-tem || sdk use java 25.0.0-tem || sdk use java 25-tem
14+
Sets up Java 25 (Temurin distribution) for the build environment.
4215
43-
# Verify Java installation
44-
java -version
16+
This uses the same approach as the project's CI/CD workflows (maven_push.yml, maven_pull_request.yml).
17+
The 'cache: maven' option automatically caches Maven dependencies in ~/.m2/repository
18+
to speed up subsequent builds.
4519
46-
# Verify Maven can use Java 25
47-
./mvnw --version
48-
notes: |
49-
Java 25 or newer is required for this project.
50-
51-
OS-specific notes:
52-
- The exact Java 25 identifier varies by platform and availability
53-
- Use 'sdk list java' to see available Java 25 versions for your system
54-
- Common identifiers: 25.0.1-tem, 25.0.0-tem, 25-tem
55-
- For Windows without WSL, download from https://adoptium.net/temurin/releases/?version=25
20+
Java 25 or newer is required for this project as specified in pom.xml.
5621
57-
# Step 3: Download and cache Maven dependencies
58-
- name: Download Maven dependencies
22+
# Step 2: Build with Maven to verify environment
23+
- name: Build with Maven
5924
shell: bash
6025
run: |
61-
# Source SDKMAN to ensure Java 25 is active
62-
source "$HOME/.sdkman/bin/sdkman-init.sh"
63-
sdk use java 25.0.1-tem || sdk use java 25.0.0-tem || sdk use java 25-tem
26+
# Run a full build with tests to verify everything works
27+
./mvnw -B clean verify --file pom.xml
28+
notes: |
29+
Runs a full Maven build including CheckStyle validation and all tests.
30+
The -B flag runs Maven in batch (non-interactive) mode.
6431
65-
# Download dependencies without running tests
66-
# This populates the local Maven cache (~/.m2/repository)
67-
./mvnw dependency:go-offline -DskipTests
32+
Build process includes:
33+
- CheckStyle validation (Google Java Style Guide)
34+
- Compilation of all modules (xapi-model, xapi-client, samples, xapi-model-spring-boot-starter)
35+
- Unit tests (300+ tests)
36+
- Integration tests
37+
- Code coverage analysis (JaCoCo)
6838
69-
# Alternative: Download and compile without running tests
70-
./mvnw clean compile -DskipTests
71-
notes: |
72-
Maven dependencies are cached in ~/.m2/repository directory.
73-
This step downloads all required dependencies to avoid repeated downloads.
39+
Expected duration: 2-3 minutes on first run, faster with cached dependencies.
7440
75-
Key dependencies include:
41+
Key dependencies automatically downloaded and cached:
7642
- Spring Boot 3.5.7
7743
- Spring WebClient (reactive)
7844
- Jackson (JSON serialization)
@@ -82,41 +48,7 @@ steps:
8248
- OkHttp (HTTP client for testing)
8349
- CheckStyle (code style enforcement)
8450
85-
Cache location:
86-
- Linux/macOS: ~/.m2/repository
87-
- Windows: %USERPROFILE%\.m2\repository
88-
89-
# Step 4: Verify the environment setup
90-
- name: Verify build environment
91-
shell: bash
92-
run: |
93-
# Source SDKMAN to ensure Java 25 is active
94-
source "$HOME/.sdkman/bin/sdkman-init.sh"
95-
sdk use java 25.0.1-tem || sdk use java 25.0.0-tem || sdk use java 25-tem
96-
97-
# Run a clean build with tests to verify everything works
98-
./mvnw clean verify
99-
notes: |
100-
This step verifies that the environment is properly configured by running
101-
a full build including CheckStyle validation and all tests.
102-
103-
Build process includes:
104-
- CheckStyle validation (Google Java Style Guide)
105-
- Compilation of all modules (xapi-model, xapi-client, samples, xapi-model-spring-boot-starter)
106-
- Unit tests (300+ tests)
107-
- Integration tests
108-
- Code coverage analysis (JaCoCo)
109-
110-
Expected duration: 2-3 minutes on first run, faster with cached dependencies
111-
11251
Troubleshooting:
113-
- If build fails with "release version 25 not supported", verify Java 25 is active with 'java -version'
52+
- If build fails with "release version 25 not supported", the Java setup may have failed
11453
- If dependencies fail to download, check network connectivity
11554
- If tests fail, this may indicate an environment-specific issue
116-
117-
# Cache configuration
118-
cache:
119-
- path: ~/.m2/repository
120-
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
121-
restore-keys: |
122-
maven-${{ runner.os }}-

0 commit comments

Comments
 (0)