Files
j3270/.github/workflows/build.yaml
T
rudi cc2ee5d2d9
Build and Test j3270 / Build JAR & Run Tests (push) Successful in 5m57s
Second pass
2026-08-20 18:37:22 -04:00

82 lines
2.2 KiB
YAML

name: Build and Test j3270
on:
push:
branches: [ "master", "main", "develop" ]
pull_request:
branches: [ "master", "main" ]
workflow_dispatch:
jobs:
build:
name: Build JAR & Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Java JDK (Temurin 17)
uses: actions/setup-java@v4
continue-on-error: true
with:
java-version: '17'
distribution: 'temurin'
- name: Ensure Java JDK Available
run: |
if ! command -v javac >/dev/null 2>&1; then
echo "javac not found in PATH, installing OpenJDK..."
if command -v apt-get >/dev/null 2>&1; then
apt-get update && apt-get install -y openjdk-17-jdk-headless
elif command -v apk >/dev/null 2>&1; then
apk add --no-cache openjdk17
fi
fi
echo "Using Java compiler:"
javac -version || which javac
echo "Using Java runtime:"
java -version || which java
- name: Make scripts executable
run: |
chmod +x ./build_all.sh ./gradlew ./run.sh
- name: Run Unit Tests
run: |
if command -v gradle >/dev/null 2>&1; then
gradle test --info
else
echo "Testing via build_all.sh..."
sh ./build_all.sh
fi
- name: Build Standalone JAR
run: |
sh ./build_all.sh
- name: Upload j3270 Executable JAR Artifact
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: j3270-executable-jar
path: build/j3270.jar
if-no-files-found: warn
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: test-reports
path: |
lib3270j/build/reports/tests/
j3270/build/reports/tests/
if-no-files-found: ignore
- name: Report Build Status
if: failure()
run: |
echo "### ❌ Build or Test Failed" >> $GITHUB_STEP_SUMMARY
echo "Please check the runner logs above for details." >> $GITHUB_STEP_SUMMARY