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: Configure Dynamic DNS Resolvers run: | # Ensure container has active upstream nameservers for dynamic DNS printf "nameserver 1.1.1.1\nnameserver 8.8.8.8\n" > /etc/resolv.conf 2>/dev/null || true - name: Checkout Code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Java JDK (Temurin 17) uses: actions/setup-java@v3 continue-on-error: true with: java-version: '17' distribution: 'temurin' - name: Ensure Java Available run: | if ! command -v javac >/dev/null 2>&1; then echo "Installing OpenJDK 17 via package manager..." if command -v apt-get >/dev/null 2>&1; then apt-get update && apt-get install -y openjdk-17-jdk-headless || true elif command -v apk >/dev/null 2>&1; then apk add --no-cache openjdk17 || true fi fi echo "Java compiler:" javac -version || which javac || true echo "Java runtime:" java -version || which java || true - name: Make scripts executable run: | chmod +x ./build_all.sh ./test_all.sh ./run.sh - name: Build & Run Unit Tests run: | sh ./test_all.sh - name: Upload j3270 Executable JAR Artifact uses: actions/upload-artifact@v3 continue-on-error: true with: name: j3270-executable-jar path: build/j3270.jar - name: Upload Test Reports if: always() uses: actions/upload-artifact@v3 continue-on-error: true with: name: test-reports path: build/reports/tests/ - 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