Skip to content

Commit

Permalink
Merge branch 'pharo-project:feature/cmd-line' into feature/cmd-line
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajger authored Sep 22, 2023
2 parents 4cbcd96 + c661cf8 commit 85e53a3
Show file tree
Hide file tree
Showing 56 changed files with 758 additions and 894 deletions.
257 changes: 257 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
# 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: 100
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: |
build/
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/110/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/advinst-github-action@v1.0
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
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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Pharo Launcher [![Build Status](https://ci.inria.fr/pharo-ci-jenkins2/job/PharoLauncher-Pipeline/job/development/badge/icon)](https://ci.inria.fr/pharo-ci-jenkins2/job/PharoLauncher-Pipeline/job/development/)
# Pharo Launcher [![CI](https://github.com/pharo-project/pharo-launcher/actions/workflows/CI.yml/badge.svg)](https://github.com/pharo-project/pharo-launcher/actions/workflows/CI.yml)
The Pharo Launcher is a cross-platform application that
- lets you manage your Pharo images (launch, rename, copy and delete);
- lets you download image templates (i.e., zip archives) from many
different sources (e.g., Jenkins, files.pharo.org, and your local cache);
- lets you create new images from any template,
- automatically find and download the appropriate VM to launch your images.

<img src="./pharo-launcher-main-window.png" height="450" alt="A Pharo Launcher screenshot">
<img src="./docs/images/pharo-launcher-main-window.png" height="450" alt="A Pharo Launcher screenshot">

The idea behind the Pharo Launcher is that you should be able to access it very rapidly from your OS application launcher. As a result,
launching any image is never more than 3 clicks away.
Expand All @@ -16,7 +16,8 @@ Please report bugs on the 'Launcher' project at [https://github.com/pharo-projec
You can contribute to this project. All classes and most methods are commented. There are unit tests. Please contribute!

- **Source code:** [https://github.com/pharo-project/pharo-launcher](https://github.com/pharo-project/pharo-launcher)
- **CI:** [https://ci.inria.fr/pharo-ci-jenkins2/blue/organizations/jenkins/PharoLauncher-Pipeline/branches/](https://ci.inria.fr/pharo-ci-jenkins2/blue/organizations/jenkins/PharoLauncher-Pipeline/branches/) [![Build Status](https://ci.inria.fr/pharo-ci-jenkins2/job/PharoLauncher-Pipeline/job/development/badge/icon)](https://ci.inria.fr/pharo-ci-jenkins2/job/PharoLauncher-Pipeline/job/development/)
- **CI:** [https://github.com/pharo-project/pharo-launcher/actions](https://github.com/pharo-project/pharo-launcher/actions) [![CI](https://github.com/pharo-project/pharo-launcher/actions/workflows/CI.yml/badge.svg)](https://github.com/pharo-project/pharo-launcher/actions/workflows/CI.yml)

## Motivations
In the past, I had several folders with images everywhere on my HD. Sometimes with the VM, sometimes without. Lots of image searching as you can imagine.
Now, my HD is now much cleaner - all images are in a central place and I need only one icon/starter on the desktop to open. PharoLauncher is also a convenient tool to download specific image update versions if you want to reproduce or fix Pharo bugs. I also associated one of the unused laptop keys with PharoLauncher - so the world of Smalltalk is just one click away...
Expand Down Expand Up @@ -79,7 +80,7 @@ Once done, you can load the project through Metacello integration (uses Baseline
```Smalltalk
Metacello new
baseline: 'PharoLauncher';
repository: 'github://pharo-project/pharo-launcher:development/src';
repository: 'github://pharo-project/pharo-launcher:dev/src';
load
```

Expand Down
Loading

0 comments on commit 85e53a3

Please sign in to comment.