Update unit test #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: build | |
on: | |
workflow_dispatch: | |
push: | |
# branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
semver: | |
runs-on: ubuntu-latest | |
outputs: | |
GITVERSION_SEMVER: ${{ steps.gitversion.outputs.SemVer }} | |
GITVERSION_ASSEMBLYSEMVER: "${{ steps.gitversion.outputs.AssemblySemVer }}" | |
GITVERSION_MAJORMINORPATCH: "${{ steps.gitversion.outputs.MajorMinorPatch }}" | |
GITVERSION_MAJOR: ${{ steps.gitversion.outputs.GITVERSION_MAJOR }} | |
GITVERSION_MINOR: ${{ steps.gitversion.outputs.GITVERSION_MINOR }} | |
GITVERSION_PATCH: ${{ steps.gitversion.outputs.GITVERSION_PATCH }} | |
MACOS_MAJORMINORPATCH: ${{ steps.output1.outputs.MACOS_MAJORMINORPATCH }} | |
DEBIAN_PKGVERSION: ${{ steps.output1.outputs.DEBIAN_PKGVERSION }} | |
FLAVOR: ${{ steps.output1.outputs.FLAVOR }} | |
FLAVOR2: ${{ steps.output1.outputs.FLAVOR2 }} | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
- id: output1 | |
run: | | |
set -x | |
printenv | grep GitVersion_ | sort | |
echo "GITVERSION_SEMVER=${GitVersion_SemVer}" >> "$GITHUB_OUTPUT" | |
echo "GITVERSION_ASSEMBLYSEMVER=${GitVersion_AssemblySemVer}" >> "$GITHUB_OUTPUT" | |
echo "GITVERSION_MAJORMINORPATCH=${GitVersion_MajorMinorPatch}" >> "$GITHUB_OUTPUT" | |
echo "GITVERSION_MAJOR=${GitVersion_Major}" >> "$GITHUB_OUTPUT" | |
echo "GITVERSION_MINOR=${GitVersion_Minor}" >> "$GITHUB_OUTPUT" | |
echo "GITVERSION_PATCH=${GitVersion_Patch}" >> "$GITHUB_OUTPUT" | |
echo "DEBIAN_PKGVERSION=${GitVersion_Major}.${GitVersion_Minor}-${GitVersion_Patch}" >> "$GITHUB_OUTPUT" | |
if [ "${GitVersion_Major}" == "0" ] | |
then | |
echo "MACOS_MAJORMINORPATCH=1.${GitVersion_Minor}.${GitVersion_Patch}" >> "$GITHUB_OUTPUT" | |
else | |
echo "MACOS_MAJORMINORPATCH=${GitVersion_MajorMinorPatch}" >> "$GITHUB_OUTPUT" | |
fi | |
if [ "$GITHUB_REF_NAME" != "master" ] | |
then | |
echo "FLAVOR=_${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
echo "FLAVOR2=-${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
fi | |
build: | |
needs: [semver] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Build with Maven | |
run: | | |
mvn versions:set "-DnewVersion=${{ needs.semver.outputs.GITVERSION_SEMVER }}" | |
mvn -B package -e --file pom.xml | |
# - name: Check status | |
# run: | | |
# set | |
# echo -n "Current directory: " | |
# pwd | |
# find | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: OoliteStarter-generic | |
path: target/OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-generic.* | |
package-linux: | |
needs: [semver,build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: oolitestarter | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: OoliteStarter-generic | |
path: artifacts | |
- name: Check status 0 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Extract project | |
run: | | |
tar xvfz artifacts/OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-generic.tar.gz | |
- name: Check status 1 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Prepare AppImage for Ubuntu | |
run: | | |
jpackage \ | |
--type app-image \ | |
--app-version "${{ needs.semver.outputs.DEBIAN_PKGVERSION }}" \ | |
--copyright Copyright \ | |
--description "OoliteStarter ${{ needs.semver.outputs.GITVERSION_SEMVER }}" \ | |
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" \ | |
--dest target/appimage \ | |
--temp target/oolite-starter-tmp \ | |
--vendor "OoliteProject" \ | |
--verbose \ | |
--icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.png \ | |
--input OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}/dist \ | |
--main-jar OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}.jar \ | |
--main-class oolite.starter.MainFrame \ | |
--resource-dir oolitestarter/src/jpackage/resources-linux \ | |
# --java-options '-splash:$APPDIR/splash.png' \ | |
- name: Tweak AppImage | |
run: | | |
mv "oolitestarter/src/jpackage/resources-linux/OoliteStarter.desktop" "oolitestarter/src/jpackage/resources-linux/OoliteStarter${{ needs.semver.outputs.FLAVOR }}.desktop" | |
#cp -v "oolitestarter/src/jpackage/resources-linux/OoliteStarter.desktop" "target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }}/lib/oolitestarter${{ needs.semver.outputs.FLAVOR2 }}-oolitestarter${{ needs.semver.outputs.FLAVOR2 }}.desktop" | |
- name: Check status 2 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Finish AppImage for Ubuntu | |
run: | | |
jpackage \ | |
--verbose \ | |
--app-image target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }} \ | |
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" \ | |
--app-version "${{ needs.semver.outputs.DEBIAN_PKGVERSION }}" \ | |
--dest target \ | |
--license-file oolitestarter/LICENSE \ | |
--icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.png \ | |
--resource-dir oolitestarter/src/jpackage/resources-linux | |
#--linux-shortcut \ | |
#--linux-menu-group Game \ | |
#--linux-app-category misc \ | |
- name: Check status 3 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: OoliteStarter-Ubuntu | |
path: ./target/oolitestarter*.deb | |
package-windows: | |
needs: [semver,build] | |
runs-on: windows-latest | |
steps: | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: oolitestarter | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: OoliteStarter-generic | |
path: artifacts | |
- name: Check status 0 | |
run: | | |
gci env:* | sort-object name | |
get-childitem . -Recurse | where {!$_.PSIsContainer} | select-object FullName | |
- name: Extract project | |
run: | | |
unzip artifacts\OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-generic.zip | |
- name: Check status 1 | |
run: | | |
get-childitem . -Recurse | where {!$_.PSIsContainer} | select-object FullName | |
- name: Prepare AppImage for Windows | |
run: | | |
jpackage --type app-image ` | |
--app-version "${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}" ` | |
--copyright Copyright ` | |
--description "OoliteStarter ${{ needs.semver.outputs.GITVERSION_SEMVER }}" ` | |
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" ` | |
--dest target/appimage ` | |
--temp target/oolite-starter-tmp ` | |
--vendor "OoliteProject" ` | |
--verbose ` | |
--icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.ico ` | |
--input OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}/dist ` | |
--main-jar OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}.jar ` | |
--main-class oolite.starter.MainFrame | |
# --resource-dir src/jpackage/resources | |
- name: Check status 2 | |
run: | | |
get-childitem . -Recurse | where {!$_.PSIsContainer} | select-object FullName | |
# for upgrades, it seems we need a UUID - see https://stackoverflow.com/a/67442754/4222206 | |
- name: Finish AppImage for Windows | |
run: | | |
jpackage ` | |
--verbose ` | |
--app-image target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }} ` | |
--app-version "${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}" ` | |
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" ` | |
--dest target ` | |
--win-shortcut ` | |
--icon oolitestarter/src/main/resources/images/Mr_Gimlet_transparent.ico ` | |
--win-shortcut --win-menu --win-menu-group Oolite ` | |
--win-dir-chooser --win-upgrade-uuid 0a18c6bc-0418-47dc-9526-3a48030f6af6 | |
#--resource-dir src/jpackage/resources | |
- name: Check status 3 | |
run: | | |
get-childitem . -Recurse | where {!$_.PSIsContainer} | select-object FullName | |
- name: Rename result (target\OoliteStarter-0.1.16.0.exe) | |
run: | | |
gci env:* | sort-object name | |
$SRC = "target\OoliteStarter${{ needs.semver.outputs.FLAVOR }}-${{ needs.semver.outputs.GITVERSION_ASSEMBLYSEMVER }}.exe" | |
$DST = "OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-Windows-${env:PROCESSOR_ARCHITECTURE}.exe" | |
ren $SRC $DST | |
env: | |
PROCESSOR_ARCHITECTURE: ${PROCESSOR_ARCHITECTURE} | |
- name: Check status 4 | |
run: | | |
get-childitem . -Recurse | where {!$_.PSIsContainer} | select-object FullName | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: OoliteStarter-Windows | |
path: ./target/*.exe | |
package-macos: | |
needs: [semver,build] | |
runs-on: macos-latest | |
steps: | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: oolitestarter | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: OoliteStarter-generic | |
path: artifacts | |
- name: Check status 1 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Extract project | |
run: | | |
tar xvfz artifacts/OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-generic.tar.gz | |
- name: Check status 1 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Prepare AppImage for MacOS | |
run: | | |
jpackage \ | |
--type app-image \ | |
--app-version "${{ needs.semver.outputs.MACOS_MAJORMINORPATCH }}" \ | |
--copyright Copyright \ | |
--description "OoliteStarter ${{ needs.semver.outputs.GITVERSION_SEMVER }}" \ | |
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" --dest target/appimage \ | |
--temp target/oolite-starter-tmp --vendor "OoliteProject" --verbose \ | |
--icon oolitestarter/src/main/resources/oolite_logo.png \ | |
--input OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}/dist \ | |
--main-jar OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}.jar \ | |
--main-class oolite.starter.MainFrame --mac-package-name "OoliteStarter" \ | |
--resource-dir oolitestarter/src/jpackage/resources-mac \ | |
--vendor OoliteProject | |
# --java-options '-splash:$APPDIR/splash.png' \ | |
# --mac-sign --mac-package-signing-prefix space.oolite.oolitestarter. \ | |
# --mac-signing-key-user-name "oocube" | |
# --app-version "${{ needs.semver.outputs.GITVERSION_MAJORMINORPATCH }}" \ | |
#- name: Tweak AppImage | |
# run: | | |
# cp -v "oolitestarter/src/main/resources/images/OoliteStarter_Splashscreen_640x360.png" "target/appimage/OoliteStarter.app/Contents/app/splash.png" | |
- name: Check status 2 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Finish AppImage for MacOS | |
run: | | |
jpackage \ | |
--type pkg \ | |
--verbose \ | |
--app-version "${{ needs.semver.outputs.MACOS_MAJORMINORPATCH }}" \ | |
--app-image target/appimage/OoliteStarter${{ needs.semver.outputs.FLAVOR }}.app \ | |
--name "OoliteStarter${{ needs.semver.outputs.FLAVOR }}" \ | |
--icon oolitestarter/src/main/resources/oolite_logo.png \ | |
--dest target \ | |
--resource-dir oolitestarter/src/jpackage/resources-mac \ | |
--vendor OoliteProject | |
- name: Create ZIP distribution | |
run: | | |
cd target/appimage | |
zip -r ../OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-MacOS-${HOSTTYPE}.zip * | |
- name: Check status 3 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Rename result | |
run: | | |
mv ./target/OoliteStarter${{ needs.semver.outputs.FLAVOR }}-${{ needs.semver.outputs.MACOS_MAJORMINORPATCH }}.pkg ./target/OoliteStarter-${{ needs.semver.outputs.GITVERSION_SEMVER }}-MacOS-${HOSTTYPE}.pkg | |
- name: Check status 4 | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: OoliteStarter-MacOS | |
path: target/OoliteStarter* | |
# snap: | |
# needs: [semver,package-linux] | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - name: Checkout project | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# path: oolitestarter | |
# | |
# - name: Download artifacts | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: OoliteStarter-Ubuntu | |
# path: oolitestarter | |
# | |
# - name: Check status 1 | |
# run: | | |
# printenv | sort | |
# echo -n "Current directory: " | |
# pwd | |
# find . -not -path "./oolitestarter/.git/*" | |
# env: | |
# DEBIAN_PKGVERSION: ${{ needs.semver.outputs.DEBIAN_PKGVERSION }} | |
# GITVERSION_SEMVER: ${{ needs.semver.outputs.GITVERSION_SEMVER }} | |
# | |
# - name: version bump snapcraft.yaml | |
# run: | | |
# sed -i "s/^version:.*/version: ${{ needs.semver.outputs.GITVERSION_SEMVER }}/g" oolitestarter/snapcraft.yaml | |
# sed -i "s/^ source:.*/ source: oolitestarter_${{ needs.semver.outputs.DEBIAN_PKGVERSION }}-1_amd64.deb/g" oolitestarter/snapcraft.yaml | |
# cat oolitestarter/snapcraft.yaml | |
# | |
# - name: Build the snap | |
# id: buildsnap | |
# uses: snapcore/action-build@v1 | |
# with: | |
# path: oolitestarter | |
# | |
# - name: Check status 2 | |
# run: | | |
# printenv | sort | |
# echo -n "Current directory: " | |
# echo "Snap build output is ${{ steps.buildsnap.outputs.snap }}" | |
# pwd | |
# find . -not -path "./oolitestarter/.git/*" | |
# env: | |
# DEBIAN_PKGVERSION: ${{ needs.semver.outputs.DEBIAN_PKGVERSION }} | |
# GITVERSION_SEMVER: ${{ needs.semver.outputs.GITVERSION_SEMVER }} | |
# | |
# - name: Publish the snap | |
# uses: snapcore/action-publish@v1 | |
# env: | |
# SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPSTORE_LOGIN }} | |
# with: | |
# snap: ${{ steps.buildsnap.outputs.snap }} | |
# release: edge | |
release: | |
needs: [semver,package-linux,package-windows,package-macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Check status | |
run: | | |
set | |
echo -n "Current directory: " | |
pwd | |
find . -not -path "./oolitestarter/.git/*" | |
- name: Remove old prereleases | |
if: github.ref != 'refs/heads/master' | |
uses: dev-drprasad/[email protected] | |
with: | |
#repo: <owner>/<repoName> # defaults to current repo | |
keep_latest: 6 | |
delete_tag_pattern: v\d+\.\d+\.\d+-.* | |
delete_prerelease_only: 'true' | |
#delete_branch: '${{ github.ref_name }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Prerelease | |
if: github.ref != 'refs/heads/master' | |
id: create_prerelease | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "v${{ needs.semver.outputs.GITVERSION_SEMVER }}" | |
prerelease: true | |
title: "OoliteStarter v${{ needs.semver.outputs.GITVERSION_SEMVER }}" | |
files: | | |
artifacts/OoliteStarter-generic/*.zip | |
artifacts/OoliteStarter-generic/*.tar.gz | |
artifacts/OoliteStarter-Ubuntu/*.deb | |
artifacts/OoliteStarter-Windows/*.exe | |
artifacts/OoliteStarter-MacOS/OoliteStarter-* | |
- name: Remove old releases | |
if: github.ref == 'refs/heads/master' | |
uses: dev-drprasad/[email protected] | |
with: | |
#repo: <owner>/<repoName> # defaults to current repo | |
keep_latest: 4 | |
delete_tag_pattern: v\d+\.\d+\.\d+ | |
delete_prerelease_only: 'false' | |
#delete_branch: 'main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
if: github.ref == 'refs/heads/master' | |
id: create_release | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "v${{ needs.semver.outputs.GITVERSION_SEMVER }}" | |
prerelease: false | |
title: "OoliteStarter v${{ needs.semver.outputs.GITVERSION_SEMVER }}" | |
files: | | |
artifacts/OoliteStarter-generic/*.zip | |
artifacts/OoliteStarter-generic/*.tar.gz | |
artifacts/OoliteStarter-Ubuntu/*.deb | |
artifacts/OoliteStarter-Windows/*.exe | |
artifacts/OoliteStarter-MacOS/OoliteStarter-* | |
# No longer required as we do not provide a dmg | |
# | |
# testdmg: | |
# needs: [package-macos] | |
# runs-on: macos-latest | |
# | |
# steps: | |
# - name: Download artifacts | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: OoliteStarter-MacOS | |
# path: artifacts | |
# | |
# - name: Check status | |
# run: | | |
# set | |
# echo -n "Current directory: " | |
# pwd | |
# find . -not -path "./oolitestarter/.git/*" | |
# | |
# # inspired from https://macwrench.miraheze.org/wiki/Hdiutil | |
# # and https://stackoverflow.com/questions/18017687/how-to-check-whether-an-app-or-dmg-is-signed-or-not | |
# - name: Verify/Install | |
# run: | | |
# set -x | |
# F=$(ls artifacts/*.dmg) | |
# | |
# echo "Help..." | |
# hdiutil verify -help | |
# hdiutil imageinfo -help | |
# hdiutil hfsanalyze -help | |
# hdiutil checksum -help | |
# hdiutil info -help | |
# hdiutil pmap -help | |
# codesign -help | |
# | |
# echo "Verifying..." | |
# hdiutil verify -verbose "$F" | |
# hdiutil imageinfo -verbose "$F" | |
# hdiutil hfsanalyze -verbose "$F" | |
# hdiutil checksum -type SHA256 -verbose "$F" | |
# hdiutil info -verbose | |
# hdiutil pmap -verbose "$F" | |
# codesign --verify --verbose "$F" |