-
Notifications
You must be signed in to change notification settings - Fork 46
256 lines (219 loc) · 9.62 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
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: 120
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