Skip to content

Commit f7edd0e

Browse files
Add copilot-setup-steps.yml with Java 25 and Maven caching
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent c758db2 commit f7edd0e

1 file changed

Lines changed: 122 additions & 0 deletions

File tree

.github/copilot-setup-steps.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# GitHub Copilot Setup Steps for xAPI Java
2+
# This file configures the environment for GitHub Copilot agents working on this repository.
3+
# See: https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
4+
5+
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
20+
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
42+
43+
# Verify Java installation
44+
java -version
45+
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
56+
57+
# Step 3: Download and cache Maven dependencies
58+
- name: Download Maven dependencies
59+
shell: bash
60+
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
64+
65+
# Download dependencies without running tests
66+
# This populates the local Maven cache (~/.m2/repository)
67+
./mvnw dependency:go-offline -DskipTests
68+
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.
74+
75+
Key dependencies include:
76+
- Spring Boot 3.5.7
77+
- Spring WebClient (reactive)
78+
- Jackson (JSON serialization)
79+
- Lombok (code generation)
80+
- JUnit 5 (testing)
81+
- Hamcrest (assertions)
82+
- OkHttp (HTTP client for testing)
83+
- CheckStyle (code style enforcement)
84+
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+
112+
Troubleshooting:
113+
- If build fails with "release version 25 not supported", verify Java 25 is active with 'java -version'
114+
- If dependencies fail to download, check network connectivity
115+
- 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)