Skip to content

Commit f8a7a9d

Browse files
authored
Merge branch 'jMonkeyEngine:master' into capdevon-BinaryExporter
2 parents d5ac1f7 + b0ea539 commit f8a7a9d

File tree

47 files changed

+2637
-895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2637
-895
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#! /bin/bash
2+
set -euo pipefail
3+
4+
## Upload a deployment
5+
## from the "org.jmonkeyengine" namespace in Sonatype's OSSRH staging area
6+
## to Sonatype's Central Publisher Portal
7+
## so the deployment can be tested and then published or dropped.
8+
9+
## IMPORTANT: The upload request must originate
10+
## from the IP address used to stage the deployment to the staging area!
11+
12+
# The required -p and -u flags on the command line
13+
# specify the password and username components of a "user token"
14+
# generated using the web interface at https://central.sonatype.com/account
15+
16+
while getopts p:u: flag
17+
do
18+
case "${flag}" in
19+
p) centralPassword=${OPTARG};;
20+
u) centralUsername=${OPTARG};;
21+
esac
22+
done
23+
24+
# Combine both components into a base64 "user token"
25+
# suitable for the Authorization header of a POST request:
26+
27+
token=$(printf %s:%s "${centralUsername}" "${centralPassword}" | base64)
28+
29+
# Send a POST request to upload the deployment:
30+
31+
server='ossrh-staging-api.central.sonatype.com'
32+
endpoint='/manual/upload/defaultRepository/org.jmonkeyengine'
33+
url="https://${server}${endpoint}"
34+
35+
statusCode=$(curl "${url}" \
36+
--no-progress-meter \
37+
--output postData1.txt \
38+
--write-out '%{response_code}' \
39+
--request POST \
40+
--header 'accept: */*' \
41+
--header "Authorization: Bearer ${token}" \
42+
--data '')
43+
44+
echo "Status code = ${statusCode}"
45+
echo 'Received data:'
46+
cat postData1.txt
47+
echo '[EOF]'
48+
49+
# Retry if the default repo isn't found (status=400).
50+
51+
if [ "${statusCode}" == "400" ]; then
52+
echo "Will retry after 30 seconds."
53+
sleep 30
54+
55+
statusCode2=$(curl "${url}" \
56+
--no-progress-meter \
57+
--output postData2.txt \
58+
--write-out '%{response_code}' \
59+
--request POST \
60+
--header 'accept: */*' \
61+
--header "Authorization: Bearer ${token}" \
62+
--data '')
63+
64+
echo "Status code = ${statusCode2}"
65+
echo 'Received data:'
66+
cat postData2.txt
67+
echo '[EOF]'
68+
fi

.github/workflows/main.yml

Lines changed: 56 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# >> Configure MINIO NATIVES SNAPSHOT
1717
# OBJECTS_KEY=XXXXXX
1818
# >> Configure SONATYPE RELEASE
19-
# OSSRH_PASSWORD=XXXXXX
20-
# OSSRH_USERNAME=XXXXXX
19+
# CENTRAL_PASSWORD=XXXXXX
20+
# CENTRAL_USERNAME=XXXXXX
2121
# >> Configure SIGNING
2222
# SIGNING_KEY=XXXXXX
2323
# SIGNING_PASSWORD=XXXXXX
@@ -59,46 +59,41 @@ jobs:
5959
ScreenshotTests:
6060
name: Run Screenshot Tests
6161
runs-on: ubuntu-latest
62+
container:
63+
image: ghcr.io/onemillionworlds/opengl-docker-image:v1
6264
permissions:
6365
contents: read
6466
steps:
65-
- uses: actions/checkout@v4
66-
- name: Set up JDK 17
67-
uses: actions/setup-java@v4
68-
with:
69-
java-version: '17'
70-
distribution: 'temurin'
71-
- name: Install Mesa3D
72-
run: |
73-
sudo apt-get update
74-
sudo apt-get install -y mesa-utils libgl1-mesa-dri libgl1 libglx-mesa0 xvfb
75-
- name: Set environment variables for Mesa3D
76-
run: |
77-
echo "LIBGL_ALWAYS_SOFTWARE=1" >> $GITHUB_ENV
78-
echo "MESA_LOADER_DRIVER_OVERRIDE=llvmpipe" >> $GITHUB_ENV
79-
- name: Start xvfb
80-
run: |
81-
sudo Xvfb :99 -ac -screen 0 1024x768x16 &
82-
export DISPLAY=:99
83-
echo "DISPLAY=:99" >> $GITHUB_ENV
84-
- name: Verify Mesa3D Installation
85-
run: |
86-
glxinfo | grep "OpenGL"
87-
- name: Validate the Gradle wrapper
88-
uses: gradle/actions/wrapper-validation@v3
89-
- name: Test with Gradle Wrapper
90-
run: |
91-
./gradlew :jme3-screenshot-test:screenshotTest
92-
- name: Upload Test Reports
93-
uses: actions/upload-artifact@master
94-
if: always()
95-
with:
96-
name: screenshot-test-report
97-
retention-days: 30
98-
path: |
99-
**/build/reports/**
100-
**/build/changed-images/**
101-
**/build/test-results/**
67+
- uses: actions/checkout@v4
68+
- name: Start xvfb
69+
run: |
70+
Xvfb :99 -ac -screen 0 1024x768x16 &
71+
export DISPLAY=:99
72+
echo "DISPLAY=:99" >> $GITHUB_ENV
73+
- name: Report GL/Vulkan
74+
run: |
75+
set -x
76+
echo "DISPLAY=$DISPLAY"
77+
glxinfo | grep -E "OpenGL version|OpenGL renderer|OpenGL vendor" || true
78+
vulkaninfo --summary || true
79+
echo "VK_ICD_FILENAMES=$VK_ICD_FILENAMES"
80+
echo "MESA_LOADER_DRIVER_OVERRIDE=$MESA_LOADER_DRIVER_OVERRIDE"
81+
echo "GALLIUM_DRIVER=$GALLIUM_DRIVER"
82+
- name: Validate the Gradle wrapper
83+
uses: gradle/actions/wrapper-validation@v3
84+
- name: Test with Gradle Wrapper
85+
run: |
86+
./gradlew :jme3-screenshot-test:screenshotTest
87+
- name: Upload Test Reports
88+
uses: actions/upload-artifact@master
89+
if: always()
90+
with:
91+
name: screenshot-test-report
92+
retention-days: 30
93+
path: |
94+
**/build/reports/**
95+
**/build/changed-images/**
96+
**/build/test-results/**
10297
# Build the natives on android
10398
BuildAndroidNatives:
10499
name: Build natives for android
@@ -359,16 +354,16 @@ jobs:
359354
name: android-natives
360355
path: build/native
361356

362-
- name: Rebuild the maven artifacts and deploy them to the Sonatype repository
357+
- name: Rebuild the maven artifacts and upload them to Sonatype's maven-snapshots repo
363358
run: |
364-
if [ "${{ secrets.OSSRH_PASSWORD }}" = "" ];
359+
if [ "${{ secrets.CENTRAL_PASSWORD }}" = "" ];
365360
then
366-
echo "Configure the following secrets to enable deployment to Sonatype:"
367-
echo "OSSRH_PASSWORD, OSSRH_USERNAME, SIGNING_KEY, SIGNING_PASSWORD"
361+
echo "Configure the following secrets to enable uploading to Sonatype:"
362+
echo "CENTRAL_PASSWORD, CENTRAL_USERNAME, SIGNING_KEY, SIGNING_PASSWORD"
368363
else
369364
./gradlew publishMavenPublicationToSNAPSHOTRepository \
370-
-PossrhPassword=${{ secrets.OSSRH_PASSWORD }} \
371-
-PossrhUsername=${{ secrets.OSSRH_USERNAME }} \
365+
-PcentralPassword=${{ secrets.CENTRAL_PASSWORD }} \
366+
-PcentralUsername=${{ secrets.CENTRAL_USERNAME }} \
372367
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
373368
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
374369
-PuseCommitHashAsVersionName=true \
@@ -384,13 +379,13 @@ jobs:
384379
if: github.event_name == 'release'
385380
steps:
386381

387-
# We need to clone everything again for uploadToMaven.sh ...
382+
# We need to clone everything again for uploadToCentral.sh ...
388383
- name: Clone the repo
389384
uses: actions/checkout@v4
390385
with:
391386
fetch-depth: 1
392387

393-
# Setup jdk 21 used for building Sonatype OSSRH artifacts
388+
# Setup jdk 21 used for building Sonatype artifacts
394389
- name: Setup the java environment
395390
uses: actions/setup-java@v4
396391
with:
@@ -416,20 +411,23 @@ jobs:
416411
name: android-natives
417412
path: build/native
418413

419-
- name: Rebuild the maven artifacts and deploy them to Sonatype OSSRH
414+
- name: Rebuild the maven artifacts and upload them to Sonatype's Central Publisher Portal
420415
run: |
421-
if [ "${{ secrets.OSSRH_PASSWORD }}" = "" ];
416+
if [ "${{ secrets.CENTRAL_PASSWORD }}" = "" ];
422417
then
423-
echo "Configure the following secrets to enable deployment to Sonatype:"
424-
echo "OSSRH_PASSWORD, OSSRH_USERNAME, SIGNING_KEY, SIGNING_PASSWORD"
418+
echo "Configure the following secrets to enable uploading to Sonatype:"
419+
echo "CENTRAL_PASSWORD, CENTRAL_USERNAME, SIGNING_KEY, SIGNING_PASSWORD"
425420
else
426-
./gradlew publishMavenPublicationToOSSRHRepository \
427-
-PossrhPassword=${{ secrets.OSSRH_PASSWORD }} \
428-
-PossrhUsername=${{ secrets.OSSRH_USERNAME }} \
429-
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
430-
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
431-
-PuseCommitHashAsVersionName=true \
432-
--console=plain --stacktrace
421+
./gradlew publishMavenPublicationToCentralRepository \
422+
-PcentralPassword=${{ secrets.CENTRAL_PASSWORD }} \
423+
-PcentralUsername=${{ secrets.CENTRAL_USERNAME }} \
424+
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
425+
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
426+
-PuseCommitHashAsVersionName=true \
427+
--console=plain --stacktrace
428+
.github/actions/tools/uploadToCentral.sh \
429+
-p '${{ secrets.CENTRAL_PASSWORD }}' \
430+
-u '${{ secrets.CENTRAL_USERNAME }}'
433431
fi
434432
435433
- name: Deploy to GitHub Releases

.github/workflows/screenshot-test-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
contents: read
2222
steps:
2323
- name: Wait for GitHub to register the workflow run
24-
run: sleep 15
24+
run: sleep 120
2525

2626
- name: Wait for Screenshot Tests to complete
2727
uses: lewagon/[email protected]

common.gradle

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,35 @@ publishing {
157157
version project.version
158158
}
159159
}
160+
160161
repositories {
161162
maven {
162163
name = 'Dist'
163164
url = gradle.rootProject.projectDir.absolutePath + '/dist/maven'
164165
}
166+
167+
// Uploading to Sonatype relies on the existence of 2 properties
168+
// (centralUsername and centralPassword)
169+
// which should be set using -P options on the command line.
170+
171+
maven {
172+
// for uploading release builds to the default repo in Sonatype's OSSRH staging area
173+
credentials {
174+
username = gradle.rootProject.hasProperty('centralUsername') ? centralUsername : 'Unknown user'
175+
password = gradle.rootProject.hasProperty('centralPassword') ? centralPassword : 'Unknown password'
176+
}
177+
name = 'Central'
178+
url = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
179+
}
165180
maven {
181+
// for uploading snapshot builds to Sonatype's maven-snapshots repo
166182
credentials {
167-
username = gradle.rootProject.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
168-
password = gradle.rootProject.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
183+
username = gradle.rootProject.hasProperty('centralUsername') ? centralUsername : 'Unknown user'
184+
password = gradle.rootProject.hasProperty('centralPassword') ? centralPassword : 'Unknown password'
169185
}
170-
name = 'OSSRH'
171-
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
186+
name = 'SNAPSHOT'
187+
url = 'https://central.sonatype.com/repository/maven-snapshots/'
172188
}
173-
maven {
174-
credentials {
175-
username = gradle.rootProject.hasProperty('ossrhUsername') ? ossrhUsername : 'Unknown user'
176-
password = gradle.rootProject.hasProperty('ossrhPassword') ? ossrhPassword : 'Unknown password'
177-
}
178-
name = 'SNAPSHOT'
179-
url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
180-
}
181189
}
182190
}
183191

0 commit comments

Comments
 (0)