Fixes #691 #381
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 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@v4 | |
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@v4 # 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@v4 | |
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@v4 | |
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@v4 | |
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@v4 | |
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@v4 | |
with: | |
name: PharoLauncher-windows-${{ needs.build.outputs.launcherVersion }} | |
path: ${{ env.PACKAGE_DIR }} | |
- name: Build Advanced Installer Project | |
uses: caphyon/advinst-github-action@v2.0 | |
with: | |
advinst-version: '21.7.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@v4 | |
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@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v4 | |
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@v4 | |
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@v4 | |
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@v2 | |
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 |