Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .ci/container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

# Install basics and tools
RUN apt-get update && apt-get install -y \
curl \
wget \
gnupg \
ca-certificates \
git \
unzip \
zip \
python3 \
python3-pip \
xvfb \
libgl1-mesa-dri \
libxtst6 \
libxxf86vm1 \
ant \
maven \
libncurses6 \
libstdc++6 \
&& rm -rf /var/lib/apt/lists/*

# Setup Azul Repo
RUN curl -s https://repos.azul.com/azul-repo.key | gpg --dearmor -o /usr/share/keyrings/azul.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" | tee /etc/apt/sources.list.d/zulu.list

# Install JDKs 11, 17, 21, 25
RUN apt-get update && apt-get install -y \
zulu11-jdk \
zulu17-jdk \
zulu21-jdk \
zulu25-jdk \
&& rm -rf /var/lib/apt/lists/*

# Install ZuluFX 8 (Tarball)
# URL for Zulu 8 + FX (x64 Linux)
# Using a fixed version to ensure reproducibility.
RUN mkdir -p /usr/lib/jvm/zulu8-fx && \
curl -L "https://cdn.azul.com/zulu/bin/zulu8.82.0.21-ca-fx-jdk8.0.432-linux_x64.tar.gz" -o /tmp/zulu8.tar.gz && \
tar -xzf /tmp/zulu8.tar.gz -C /usr/lib/jvm/zulu8-fx --strip-components=1 && \
rm /tmp/zulu8.tar.gz

# Clone cn1-binaries
RUN git clone --depth=1 https://github.com/codenameone/cn1-binaries /opt/cn1-binaries

# Set Environment Variables for JDKs (Paths for apt installed JDKs usually symlinked to /usr/lib/jvm/zulu-XX-amd64)
ENV JAVA8_HOME=/usr/lib/jvm/zulu8-fx
ENV JDK8_HOME=/usr/lib/jvm/zulu8-fx
ENV JAVA11_HOME=/usr/lib/jvm/zulu11-ca-amd64
ENV JDK11_HOME=/usr/lib/jvm/zulu11-ca-amd64
ENV JAVA17_HOME=/usr/lib/jvm/zulu17-ca-amd64
ENV JDK17_HOME=/usr/lib/jvm/zulu17-ca-amd64
ENV JAVA21_HOME=/usr/lib/jvm/zulu21-ca-amd64
ENV JDK21_HOME=/usr/lib/jvm/zulu21-ca-amd64
ENV JAVA25_HOME=/usr/lib/jvm/zulu25-ca-amd64
ENV JDK25_HOME=/usr/lib/jvm/zulu25-ca-amd64

# Install Android SDK
ENV ANDROID_HOME=/opt/android-sdk
ENV ANDROID_SDK_ROOT=/opt/android-sdk
ENV CMDLINE_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"

RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
wget -q ${CMDLINE_TOOLS_URL} -O /tmp/cmdline-tools.zip && \
unzip -q /tmp/cmdline-tools.zip -d ${ANDROID_HOME}/cmdline-tools && \
mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest && \
rm /tmp/cmdline-tools.zip

ENV PATH=${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/emulator:${PATH}

# Accept licenses and install packages
# Note: sdkmanager requires Java 11+ to run. We use JAVA17_HOME for this step.
# We dynamically locate Zulu 17 to ensure the correct path is used.
RUN export JAVA17_REAL=$(find /usr/lib/jvm -maxdepth 1 -name "zulu*17*" -type d | head -n 1) && \
echo "Using JDK 17 at: $JAVA17_REAL" && \
yes | JAVA_HOME=$JAVA17_REAL sdkmanager --licenses && \
JAVA_HOME=$JAVA17_REAL sdkmanager "platform-tools" "platforms;android-31" "build-tools;31.0.0"

# Set Default JAVA_HOME to Java 8 (as per user requirement for builds)
ENV JAVA_HOME=/usr/lib/jvm/zulu8-fx
ENV PATH=$JAVA_HOME/bin:$PATH

ENV CN1_BINARIES=/opt/cn1-binaries

# Verify installations
RUN java -version && \
$JAVA11_HOME/bin/java -version && \
$JAVA17_HOME/bin/java -version && \
$JAVA21_HOME/bin/java -version && \
$JAVA25_HOME/bin/java -version && \
ant -version && \
mvn -version && \
python3 --version && \
JAVA_HOME=${JAVA17_HOME} sdkmanager --version
13 changes: 6 additions & 7 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ on:
paths-ignore:
- 'CodenameOneDesigner/**'

permissions:
contents: read
packages: read

jobs:
build-linux-jdk8:

runs-on: ubuntu-latest
container:
image: ghcr.io/codenameone/codenameone/ci-container:latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 1.8
java-package: jdk
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install xvfb
- name: Build with Maven
run: |
cd maven
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build CI Container

on:
push:
paths:
- '.ci/container/**'
- '.github/workflows/build-container.yml'
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Downcase Image Name
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}/ci-container" >> ${GITHUB_ENV}

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .ci/container
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
103 changes: 24 additions & 79 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,20 @@ permissions:
contents: write
pull-requests: write
issues: write
packages: read

jobs:
build-test:
build-linux-jdk8-fx:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java-version: [8, 17, 21, 25]
container:
image: ghcr.io/codenameone/codenameone/ci-container:latest
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v1
- name: Set up JDK 8
if: matrix.java-version == 8
uses: actions/setup-java@v1
with:
java-version: 1.8
java-package: jdk+fx
- name: Set up JDK
if: matrix.java-version != 8
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
Expand All @@ -65,30 +55,21 @@ jobs:
${{ runner.os }}-m2
- name: Run Unit Tests
run: |
MVN_ARGS=""
if [ "${{ matrix.java-version }}" != "8" ]; then
MVN_ARGS="-Dspotbugs.skip=true"
fi
cd maven
mvn clean verify -DunitTests=true -pl core-unittests -am -Dmaven.javadoc.skip=true -Plocal-dev-javase $MVN_ARGS
mvn clean verify -DunitTests=true -pl core-unittests -am -Dmaven.javadoc.skip=true -Plocal-dev-javase
cd ..
- name: Prepare Codename One binaries for Maven plugin tests
run: |
set -euo pipefail
rm -rf maven/target/cn1-binaries
git clone --depth=1 --filter=blob:none https://github.com/codenameone/cn1-binaries maven/target/cn1-binaries
- name: Run Maven plugin tests
working-directory: maven
env:
CN1_BINARIES: ${{ github.workspace }}/maven/target/cn1-binaries
CN1_BINARIES: /opt/cn1-binaries
run: |
mvn -B -Dmaven.javadoc.skip=true \
-DunitTests=true \
-Dcodename1.platform=javase \
-Dcn1.binaries="${CN1_BINARIES}" \
-pl codenameone-maven-plugin -am -Plocal-dev-javase test
- name: Generate static analysis HTML summaries
if: ${{ always() && matrix.java-version == 8 }}
if: ${{ always() }}
env:
QUALITY_REPORT_TARGET_DIRS: maven/core-unittests/target
QUALITY_REPORT_SERVER_URL: ${{ github.server_url }}
Expand All @@ -97,7 +78,7 @@ jobs:
QUALITY_REPORT_GENERATE_HTML_ONLY: "1"
run: python3 .github/scripts/generate-quality-report.py
- name: Collect quality artifacts
if: ${{ always() && matrix.java-version == 8 }}
if: ${{ always() }}
run: |
set -euo pipefail
mkdir -p quality-artifacts/static-analysis
Expand Down Expand Up @@ -125,14 +106,14 @@ jobs:
echo "No quality artifacts were generated." > quality-artifacts/README.txt
fi
- name: Upload quality artifacts
if: ${{ always() && matrix.java-version == 8 }}
if: ${{ always() }}
id: upload-quality-artifacts
uses: actions/upload-artifact@v4
with:
name: quality-artifacts
path: quality-artifacts
- name: Publish quality report previews
if: ${{ always() && matrix.java-version == 8 && github.server_url == 'https://github.com' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
if: ${{ always() && github.server_url == 'https://github.com' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
id: publish-quality-previews
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -198,7 +179,7 @@ jobs:
echo "jacoco_url=${preview_base}/coverage/index.html" >> "$GITHUB_OUTPUT"
fi
- name: Generate quality report summary
if: ${{ always() && matrix.java-version == 8 }}
if: ${{ always() }}
env:
QUALITY_REPORT_TARGET_DIRS: maven/core-unittests/target
QUALITY_REPORT_SERVER_URL: ${{ github.server_url }}
Expand All @@ -214,45 +195,30 @@ jobs:
JACOCO_HTML_URL: ${{ steps.publish-quality-previews.outputs.jacoco_url }}
run: python3 .github/scripts/generate-quality-report.py
- name: Upload quality report summary
if: ${{ always() && matrix.java-version == 8 }}
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: quality-report
path: quality-report.md
- name: Publish quality report comment
if: ${{ github.event_name == 'pull_request' && matrix.java-version == 8 }}
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v7
with:
script: |
const { publishQualityComment } = require('./.github/scripts/publish-quality-comment.js');
await publishQualityComment({ github, context, core });
- name: Install dependencies
- name: Link cn1-binaries
run: |
sudo apt-get update && sudo apt-get install xvfb
wget https://github.com/codenameone/cn1-binaries/archive/refs/heads/master.zip
unzip master.zip -d ..
mv ../cn1-binaries-master ../cn1-binaries
- name: Build CLDC11 JAR
run: |
ANT_OPTS_ARGS=""
if [ "${{ matrix.java-version }}" != "8" ]; then
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
fi
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/CLDC11/build.xml jar
ln -sf $CN1_BINARIES ../cn1-binaries
- name: Build with Ant
run: |
ANT_OPTS_ARGS=""
if [ "${{ matrix.java-version }}" != "8" ]; then
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
fi
xvfb-run ant $ANT_OPTS_ARGS test-javase
run: xvfb-run ant test-javase
- name: Build CLDC11 JAR
run: ant -noinput -buildfile Ports/CLDC11/build.xml jar

- name: Build Release
if: matrix.java-version == 8
run: ant -noinput -buildfile CodenameOne/build.xml weeklyLibUpdate

- name: Build JavaDocs
if: matrix.java-version == 8
run: |
cd CodenameOne
mkdir -p build
Expand All @@ -267,18 +233,12 @@ jobs:
cd ..

- name: Build iOS Port
run: |
ANT_OPTS_ARGS=""
if [ "${{ matrix.java-version }}" != "8" ]; then
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
fi
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/iOSPort/build.xml jar
run: ant -noinput -buildfile Ports/iOSPort/build.xml jar

- name: Build iOS VM API
run: mvn -f vm/JavaAPI/pom.xml package

- name: Upload a Build Artifact
if: matrix.java-version == 8
uses: actions/upload-artifact@v4
with:
name: JavaAPI.jar
Expand All @@ -288,41 +248,27 @@ jobs:
run: mvn -f vm/ByteCodeTranslator/pom.xml package

- name: Build CLDC 11 VM
run: |
ANT_OPTS_ARGS=""
if [ "${{ matrix.java-version }}" != "8" ]; then
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
fi
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/CLDC11/build.xml jar
run: ant -noinput -buildfile Ports/CLDC11/build.xml jar

- name: Upload a Build Artifact
if: matrix.java-version == 8
uses: actions/upload-artifact@v4
with:
name: ByteCodeTranslator.jar
path: vm/ByteCodeTranslator/target/ByteCodeTranslator-1.0-SNAPSHOT.jar

- name: Upload a Build Artifact
if: matrix.java-version == 8
uses: actions/upload-artifact@v4
with:
name: CLDC11.jar
path: Ports/CLDC11/dist/CLDC11.jar

- name: Build Android Port
run: |
ANT_OPTS_ARGS=""
if [ "${{ matrix.java-version }}" != "8" ]; then
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
fi
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/Android/build.xml jar
run: ant -noinput -buildfile Ports/Android/build.xml jar

- name: Packaging Everything
if: matrix.java-version == 8
run: zip -j result.zip CodenameOne/javadocs.zip CodenameOne/dist/CodenameOne.jar CodenameOne/updatedLibs.zip Ports/JavaSE/dist/JavaSE.jar build/CodenameOneDist/CodenameOne/demos/CodenameOne_SRC.zip

- name: Copying Files to Server
if: matrix.java-version == 8
uses: marcodallasanta/[email protected]
with:
host: ${{ secrets.WP_HOST }}
Expand All @@ -331,7 +277,6 @@ jobs:
local: result.zip

- name: Upload a Build Artifact
if: matrix.java-version == 8
uses: actions/upload-artifact@v4
with:
name: JavaSE.jar
Expand Down
Loading
Loading