Skip to content

Commit

Permalink
Merge pull request #1 from pharo-project/enh/PR616
Browse files Browse the repository at this point in the history
refactor PhLImageProcess creation and fix date conversion (from ps) on mac os
  • Loading branch information
Bajger authored Feb 5, 2024
2 parents 3486a92 + 6883559 commit a59699f
Show file tree
Hide file tree
Showing 191 changed files with 2,098 additions and 2,352 deletions.
256 changes: 256 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events
push:
branches:
- '**'
tags:
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
# Allows you to reuse this workflow from another one
workflow_call:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
PHARO: 110
ARCHITECTURE: 64
VM: vm
isRelease: ${{ startsWith(github.ref, 'refs/tags/') }}

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set environment
run: |
echo GITHUB_REF_NAME = ${GITHUB_REF_NAME}
echo GITHUB_SHA = ${GITHUB_SHA}
echo isRelease = ${{ env.isRelease }}
echo GITHUB_WORKSPACE = $GITHUB_WORKSPACE
SHORT_SHA=$(git rev-parse --short HEAD)
echo SHORT_SHA = $SHORT_SHA
echo "SHORT_SHA=$SHORT_SHA" >> $GITHUB_ENV
case ${{ env.isRelease }} in
(true) export LAUNCHER_VERSION="$(git describe --tags --always)";;
(false) export LAUNCHER_VERSION=$SHORT_SHA;;
*) echo "${{ env.isRelease }}";;
esac
echo "LAUNCHER_VERSION=$LAUNCHER_VERSION" >> $GITHUB_ENV
echo LAUNCHER_VERSION = $LAUNCHER_VERSION
if [ '${{ env.ARCHITECTURE }}' = '64' ]; then
export FILE_NAME_ARCH_SUFFIX='x64'
fi
echo "FILE_NAME_ARCH_SUFFIX=$FILE_NAME_ARCH_SUFFIX" >> $GITHUB_ENV
echo FILE_NAME_ARCH_SUFFIX = $FILE_NAME_ARCH_SUFFIX
- name: Build and test
run: |
VERSION=${SHORT_SHA} ./build.sh prepare
VERSION=${SHORT_SHA} ./build.sh test
- uses: actions/upload-artifact@v3 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-results
path: ./*.xml

- name: Test report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Pharo Launcher Tests # Name of the check run which will be created
path: ./*.xml # Path to test results
reporter: java-junit # Format of test results

- name: Make Pharo Launcher deployed
run: ./build.sh make-deployed

- uses: actions/upload-artifact@v3
with:
name: packaging-user
path: |
PharoLauncher.image
PharoLauncher.changes
Pharo*.sources
- name: Linux packaging
run: VERSION=${LAUNCHER_VERSION} ./build.sh linux-package

- uses: actions/upload-artifact@v3
with:
name: PharoLauncher-linux-${{ env.LAUNCHER_VERSION }}-${{ env.FILE_NAME_ARCH_SUFFIX }}
path: pharo-launcher-linux.tar

outputs:
launcherVersion: ${{ env.LAUNCHER_VERSION }}

win-package:
name: Windows packaging
needs: build
runs-on: windows-latest
env:
PACKAGE_DIR: windows\pharo-launcher-win

steps:
- name: Compute Installer version
shell: bash
run: |
# VERSION cannot be a string in Advanced Installer. Let's use 0.0.0 for bleeding edge versions
installerVersion=0.0.0
if [ "${{ env.isRelease }}" = true ] ; then
# only get version number, not arch
# uses bash parameter expansion using a pattern.
# see https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html
# and https://tldp.org/LDP/abs/html/string-manipulation.html
installerVersion=${{ needs.build.outputs.launcherVersion }}
installerVersion=${installerVersion%-*}
fi
echo installerVersion = $installerVersion
echo "INSTALLER_VERSION=$installerVersion" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Prepare files
shell: pwsh
run: |
Invoke-WebRequest -OutFile pharo-win-stable-signed.zip -Uri http://files.pharo.org/get-files/${{ env.PHARO }}/pharo-win-stable-signed.zip
Expand-Archive -LiteralPath .\pharo-win-stable-signed.zip -DestinationPath $Env:PACKAGE_DIR
$Env:IMAGES_DIR = "${Env:PACKAGE_DIR}\images"
mkdir "$Env:IMAGES_DIR"
Invoke-WebRequest -OutFile ${Env:IMAGES_DIR}\pharo-stable.zip -Uri https://files.pharo.org/image/stable/stable-64.zip
- uses: actions/download-artifact@v3
with:
name: packaging-user
path: ${{ env.PACKAGE_DIR }}

- name: Display structure of files to package
run: Get-ChildItem -Recurse ${{ env.PACKAGE_DIR }}

- uses: actions/upload-artifact@v3
with:
name: PharoLauncher-windows-${{ needs.build.outputs.launcherVersion }}
path: ${{ env.PACKAGE_DIR }}

- name: Build Advanced Installer Project
uses: caphyon/[email protected]
with:
advinst-version: '20.9.1'
advinst-enable-automation: 'true'

# See https://www.advancedinstaller.com/user-guide/tutorial-powershell-commands-installation.html for more details
- name: Build setup using Advinst Powershell Automation
shell: pwsh
run: |
$advinst = New-Object -ComObject AdvancedInstaller
$project = $advinst.CreateProjects("simple")
$project.ProductDetails.Name = “Pharo Launcher”
$project.ProductDetails.Publisher= “Pharo project”
$project.ProductDetails.Version= “${{ env.INSTALLER_VERSION }}”
$Env:PHARO_LAUNCHER_ICON = "${{ github.workspace }}\icons\pharo-launcher.ico"
$project.ProductDetails.SetIcon($Env:PHARO_LAUNCHER_ICON)
$project.InstallParameters.ApplicationFolder = "[LocalAppDataFolder]\[ProductName]"
$project.FilesComponent.AddFolderContents(“appdir”, “${{ github.workspace }}\${{ env.PACKAGE_DIR }}”)
$project.FilesComponent.Files
$project.ShortcutsComponent.CreateFileShortcutS("desktopfolder", "appdir\Pharo.exe")
$project.ShortcutsComponent.CreateFileShortcutS("programmenufolder", "appdir\Pharo.exe")
$project.ShortcutsComponent.CreateFileShortcutS($project.PredefinedFolders.ShortcutFolder.FullPath, "appdir\Pharo.exe")
for ($index = 0 ; $index -le 2 ; $index++) {
$shortcut = $project.ShortcutsComponent.Shortcuts[$index]
$shortcut.Icon($Env:PHARO_LAUNCHER_ICON)
$shortcut.Name = 'Pharo Launcher'
$shortcut.Arguments = 'PharoLauncher.image'
}
$outputFolder = "${{ github.workspace }}\setup";
$defaultBuild = $project.BuildComponent.Builds[0];
$defaultBuild.OutputFolder = $outputFolder
$projectFile = "${{ github.workspace }}\pharo-launcher-${{ needs.build.outputs.launcherVersion }}.aip"
$project.SaveAs($projectFile)
get-content $projectFile
$project.Build()
- uses: actions/upload-artifact@v3
with:
name: PharoLauncher-windows-installer-${{ needs.build.outputs.launcherVersion }}
path: setup/pharo-launcher*.msi

mac-package:
name: Mac OS packaging
needs: build
runs-on: macos-latest
env:
RESOURCES_DIR: PharoLauncher.app/Contents/Resources
strategy:
matrix:
arch: [64, arm64]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/download-artifact@v3
with:
name: packaging-user
path: ${{ env.RESOURCES_DIR }}

- name: Build ${{ matrix.arch }} mac os package
run: ARCHITECTURE=${{ matrix.arch }} VERSION=${{ needs.build.outputs.launcherVersion }} ./build.sh mac-package

- uses: actions/upload-artifact@v3
with:
name: PharoLauncher-mac-installer-${{ needs.build.outputs.launcherVersion }}-${{ matrix.arch == '64' && 'x64' || matrix.arch }}
path: PharoLauncher-*.dmg

publish:
runs-on: ubuntu-latest
needs: [ build, mac-package, win-package ]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artefacts
uses: actions/download-artifact@v3
with:
path: artifacts

- name: Prepare upload
run: |
LINUX_PKG_NAME=$(echo artifacts/PharoLauncher-linux-${{ needs.build.outputs.launcherVersion }}-*)
echo LINUX_PKG_NAME = $LINUX_PKG_NAME
zip -q -r -9 $LINUX_PKG_NAME.zip $LINUX_PKG_NAME
WINDOWS_PKG_NAME=$(echo artifacts/PharoLauncher-windows-${{ needs.build.outputs.launcherVersion }})
echo WINDOWS_PKG_NAME = $WINDOWS_PKG_NAME
zip -q -r -9 $WINDOWS_PKG_NAME.zip $WINDOWS_PKG_NAME
ls -R .
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
**/*.msi
**/*.dmg
artifacts/*.zip
body: |
Warning: Release artefacts below are not signed nor notarized and by consequence, are not recognized as safe by Operating Systems.
You can still use them but the prefered way is to download signed and notarized installers from https://pharo.org/download
29 changes: 29 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: documentation
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
deploy-to-gh-pages:
type: boolean
description: Deploy the documentation built with mkdocs to GitHub pages?

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- run: pip install mkdocs

- run: mkdocs build
if: github.event.inputs.deploy-to-gh-pages == 'false'
- uses: actions/upload-artifact@v3
with:
name: pharo-launcher-documentation
path: site
if: github.event.inputs.deploy-to-gh-pages == 'false'

- run: mkdocs gh-deploy
if: github.event.inputs.deploy-to-gh-pages == 'true'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ site/
*.html

*.swp

.DS_Store
35 changes: 28 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def buildArchitecture(architecture, pharoVersion) {
}
} */
archiveArtifacts artifacts: 'pharo-launcher-*.msi, Pharo-win.zip', fingerprint: true
stash includes: 'pharo-launcher-*.msi', name: "pharo-launcher-win-${architecture}-package"
stash includes: 'pharo-launcher-*.msi, Pharo-win.zip', name: "pharo-launcher-win-${architecture}-package"
}
}
}
Expand Down Expand Up @@ -96,6 +96,7 @@ def buildArchitecture(architecture, pharoVersion) {
if (isNotArm64Architecure()) {
unstash "pharo-launcher-win-${architecture}-package"
upload('pharo-launcher-*.msi', uploadDirectoryName())
upload('Pharo-win.zip', uploadDirectoryName())
}
unstash "pharo-launcher-osx-${architecture}-package"
fileToUpload = 'PharoLauncher*-' + fileNameArchSuffix(architecture) + '.dmg'
Expand Down Expand Up @@ -123,9 +124,7 @@ def notifyBuild() {
}

def cleanUploadFolderIfNeeded(launcherVersion) {
if (isPullRequest()) {
//Only upload files if not in a PR (i.e., CHANGE_ID not empty)
echo "[DO NO UPLOAD] In PR " + (env.CHANGE_ID?.trim())
if (shouldNotUpload()) {
return;
}

Expand Down Expand Up @@ -159,9 +158,7 @@ def finalizeUpload(launcherVersion) {
}

def upload(file, launcherVersion) {
if (isPullRequest()) {
//Only upload files if not in a PR (i.e., CHANGE_ID not empty)
echo "[DO NO UPLOAD] In PR " + (env.CHANGE_ID?.trim())
if (shouldNotUpload()) {
return;
}

Expand All @@ -185,6 +182,30 @@ def fileNameArchSuffix(architecture) {
return (architecture == '64') ? 'x64' : architecture
}

def shouldNotUpload() {
if (isRelease) {
return false
}

if (isPullRequest()) {
//Only upload files if not in a PR (i.e., CHANGE_ID not empty)
echo "[DO NO UPLOAD] In PR " + (env.CHANGE_ID?.trim())
return true
}

if (isNotDevBranch()) {
echo "[DO NO UPLOAD] In branch " + (env.BRANCH_NAME?.trim())
return true
}

// Do upload
return false
}

def isNotDevBranch() {
return env.BRANCH_NAME != "dev"
}

def isPullRequest() {
return env.CHANGE_ID != null
}
Expand Down
17 changes: 0 additions & 17 deletions PharoLauncherCmdLine-description.md

This file was deleted.

Loading

0 comments on commit a59699f

Please sign in to comment.