Skip to content

Commit daa53ee

Browse files
Integrate Docker container into PR workflow (#4325)
* Integrate Docker container into pr.yml workflow Switch the PR CI workflow to run inside the `pr-ci-container` image. - Add `packages: read` permission. - Set `container: ghcr.io/codenameone/codenameone/pr-ci-container:latest`. - Use container environment variables (`JAVA{v}_HOME`) to configure Java versions instead of `actions/setup-java`. - Remove redundant dependency installations (`apt-get`, `wget`) and use pre-installed binaries from `/opt/cn1-binaries`. * Integrate Docker container into pr.yml workflow Switch the PR CI workflow to run inside the `pr-ci-container` image. - Add `packages: read` permission. - Set `container: ghcr.io/codenameone/codenameone/pr-ci-container:latest`. - Configure `JAVA_HOME` using container environment variables (`JAVA_HOME_8`, `JAVA_HOME_17`, `JAVA_HOME_21`) instead of `actions/setup-java`. - Remove redundant dependency installations (`apt-get`, `wget`) and use pre-installed binaries from `/opt/cn1-binaries`. - Remove Java 25 from the build matrix as it is not supported in the container. * Fix Android encoding issue and integrate Docker container into PR workflow 1. Replaced non-ASCII '→' character with '->' in `AndroidScreenshotTask.java` to fix `javac` "unmappable character" errors in ASCII-only environments. 2. Migrated `.github/workflows/pr.yml` to run inside the `pr-ci-container` Docker image: - Added `packages: read` permission. - Configured `JAVA_HOME` using container environment variables (`JAVA_HOME_8`, etc.) instead of `actions/setup-java`. - Replaced redundant dependency downloads with local symlinks/copies from `/opt/cn1-binaries`. - Removed Java 25 from the build matrix as it's not supported in the container. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent c684d67 commit daa53ee

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

.github/workflows/pr.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,35 @@ permissions:
3232
contents: write
3333
pull-requests: write
3434
issues: write
35+
packages: read
3536

3637
jobs:
3738
build-test:
3839

3940
runs-on: ubuntu-latest
41+
container: ghcr.io/codenameone/codenameone/pr-ci-container:latest
42+
defaults:
43+
run:
44+
shell: bash
4045
strategy:
4146
fail-fast: false
4247
matrix:
43-
java-version: [8, 17, 21, 25]
48+
java-version: [8, 17, 21]
4449

4550
steps:
4651
- uses: actions/checkout@v1
47-
- name: Set up JDK 8
48-
if: matrix.java-version == 8
49-
uses: actions/setup-java@v1
50-
with:
51-
java-version: 1.8
52-
java-package: jdk+fx
53-
- name: Set up JDK
54-
if: matrix.java-version != 8
55-
uses: actions/setup-java@v4
56-
with:
57-
distribution: 'zulu'
58-
java-version: ${{ matrix.java-version }}
52+
- name: Set up Java
53+
run: |
54+
if [ "${{ matrix.java-version }}" = "8" ]; then
55+
echo "JAVA_HOME=${JAVA_HOME_8}" >> $GITHUB_ENV
56+
echo "${JAVA_HOME_8}/bin" >> $GITHUB_PATH
57+
elif [ "${{ matrix.java-version }}" = "17" ]; then
58+
echo "JAVA_HOME=${JAVA_HOME_17}" >> $GITHUB_ENV
59+
echo "${JAVA_HOME_17}/bin" >> $GITHUB_PATH
60+
elif [ "${{ matrix.java-version }}" = "21" ]; then
61+
echo "JAVA_HOME=${JAVA_HOME_21}" >> $GITHUB_ENV
62+
echo "${JAVA_HOME_21}/bin" >> $GITHUB_PATH
63+
fi
5964
- name: Cache Maven dependencies
6065
uses: actions/cache@v4
6166
with:
@@ -76,7 +81,8 @@ jobs:
7681
run: |
7782
set -euo pipefail
7883
rm -rf maven/target/cn1-binaries
79-
git clone --depth=1 --filter=blob:none https://github.com/codenameone/cn1-binaries maven/target/cn1-binaries
84+
mkdir -p maven/target
85+
cp -r /opt/cn1-binaries maven/target/cn1-binaries
8086
- name: Run Maven plugin tests
8187
working-directory: maven
8288
env:
@@ -226,12 +232,8 @@ jobs:
226232
script: |
227233
const { publishQualityComment } = require('./.github/scripts/publish-quality-comment.js');
228234
await publishQualityComment({ github, context, core });
229-
- name: Install dependencies
230-
run: |
231-
sudo apt-get update && sudo apt-get install xvfb
232-
wget https://github.com/codenameone/cn1-binaries/archive/refs/heads/master.zip
233-
unzip master.zip -d ..
234-
mv ../cn1-binaries-master ../cn1-binaries
235+
- name: Link cn1-binaries
236+
run: ln -s /opt/cn1-binaries ../cn1-binaries
235237
- name: Build CLDC11 JAR
236238
run: |
237239
ANT_OPTS_ARGS=""

Ports/Android/src/com/codename1/impl/android/AndroidScreenshotTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void onPixelCopyFinished(int copyResult) {
7373
new Handler(Looper.getMainLooper())
7474
);
7575
} catch (Throwable t) {
76-
// Any unexpected issue fallback
76+
// Any unexpected issue -> fallback
7777
Log.e(t);
7878
tryFallbackDraw(w, h);
7979
}

0 commit comments

Comments
 (0)