Skip to content

Commit

Permalink
Merge 1bdfa45
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Sep 30, 2021
2 parents c046fdf + 1bdfa45 commit 0f2fe48
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 18 deletions.
18 changes: 10 additions & 8 deletions .github/scripts/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ ci_build_dir=$SMALLTALK_CI_BUILD
package_dir="$PROJECT_NAME-$PLATFORM"
vm_dir=`cat $SMALLTALK_CI_VM | sed 's|\(.*\)/.*|\1|'`/pharo-vm

mkdir -p "$package_dir"
mkdir -p "$package_dir/image"
mkdir -p "$package_dir/pharo"

cp $ci_build_dir/TravisCI.image $package_dir/$PROJECT_NAME.image
cp $ci_build_dir/TravisCI.changes $package_dir/$PROJECT_NAME.changes
cp $ci_build_dir/*.sources $package_dir
cp $ci_build_dir/TravisCI.image $package_dir/image/$PROJECT_NAME.image
cp $ci_build_dir/TravisCI.changes $package_dir/image/$PROJECT_NAME.changes
cp $ci_build_dir/*.sources $package_dir/image

cp -r $vm_dir/bin $package_dir/pharo/bin
cp -r $vm_dir/lib $package_dir/pharo/lib

cp -r $vm_dir/bin $package_dir/bin
cp -r $vm_dir/lib $package_dir/lib
cat << EOF > $package_dir/$PROJECT_NAME
#!/bin/bash
./bin/pharo $PROJECT_NAME.image
\`dirname "\$0"\`/pharo/bin/pharo \`dirname "\$0"\`/image/$PROJECT_NAME.image
EOF

chmod a+rx $package_dir/$PROJECT_NAME

"$vm_dir/bin/pharo" --headless $package_dir/$PROJECT_NAME.image eval --save "OPVersion currentWithRunId: $RUN_ID projectName: '$REPOSITORY_NAME'"
"$vm_dir/bin/pharo" --headless $package_dir/image/$PROJECT_NAME.image eval --save "OPVersion currentWithRunId: $RUN_ID projectName: '$REPOSITORY_NAME'"

zip -qr $PROJECT_NAME-$PLATFORM-$VERSION.zip $package_dir
79 changes: 79 additions & 0 deletions .github/scripts/build-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

set -euxo pipefail

ci_build_dir=$SMALLTALK_CI_BUILD
package_dir="$PROJECT_NAME-$PLATFORM"
vm_dir=`cat $SMALLTALK_CI_VM | sed 's|\(.*\)/.*|\1|'`/pharo-vm

mkdir -p "$package_dir/image"

cp -r $vm_dir/Pharo.app/ $package_dir/Pharo.app

cp $ci_build_dir/TravisCI.image $package_dir/image/$PROJECT_NAME.image
cp $ci_build_dir/TravisCI.changes $package_dir/image/$PROJECT_NAME.changes
cp $ci_build_dir/*.sources $package_dir/image

cat << EOF > $package_dir/$PROJECT_NAME
#!/bin/bash
\`dirname "\$0"\`/Pharo.app/Contents/MacOS/Pharo \`dirname "\$0"\`/image/$PROJECT_NAME.image
EOF

chmod a+rx $package_dir/$PROJECT_NAME

cat << EOF > $package_dir/README.txt
-- Opening OpenPonk on macOS 10 and 11 --
Main issue of opening OpenPonk on macOS 10 is Gatekeeper protection against executables from unverified sources.
There are two options to overcome it.
First option requires a little more clicking each time opening OpenPonk, but very simple first time setup,
Second option requires much more steps first time opening (or after updating OP), but further opening becomes simple double click.
First option:
First time opening (or after updating OP):
1) Double click Pharo.app
-> "Pharo cannot be opened because the developer cannot be verified"
2) Cancel
3) Right click Pharo.app
4) Open
-> "macOS cannot verify the developer of Pharo"
5) Open
-> Window with file selection opened
6) Find and select file $PROJECT_NAME.image in the image folder
-> "Pharo would like to access files"...
7) OK
-> OpenPonk should open now. If there is a window asking to receive keystrokes, you may Deny it
Opening:
1) Double click Pharo.app
-> Window with file selection opened
2) Find and select file $PROJECT_NAME.image in the image folder
Second option:
First time opening (or after updating OP):
1) Right click the $PROJECT_NAME (Unix executable)
2) Open
-> "macOS cannot verify the developer of $PROJECT_NAME"
3) Open
-> "Pharo cannot be opened because the developer cannot be verified"
4) Cancel
5) Open macOS System Preferences...
6) Security & Privacy
7) Switch to General tab (if not already there)
-> There should be text about "Pharo" or "Pharo.app" being blocked and Open Anyway button next to it.
8) Click on Open Anyway button
-> "macOS cannot verify the developer of Pharo"
9) Open
-> Window with file selection opened
10) Cancel
11) Double click $PROJECT_NAME (Unix executable)
-> "Terminal would like to access files"... That, along with next step, might be skipped if the access is already granted.
12) OK
-> OpenPonk should open now. If there is a window asking to receive keystrokes, you may Deny it
Opening:
1) Double click $PROJECT_NAME (Unix executable)
EOF

$vm_dir/Pharo.app/Contents/MacOS/Pharo --headless $package_dir/image/$PROJECT_NAME.image eval --save "OPVersion currentWithRunId: $RUN_ID projectName: '$REPOSITORY_NAME'"

zip -qr $PROJECT_NAME-$PLATFORM-$VERSION.zip $package_dir
17 changes: 11 additions & 6 deletions .github/scripts/build-win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ $vm_file_content=Get-Content $ci_build_dir/vm | Out-String
$vm_dir=(($vm_file_content -replace '/[^/]*$','/pharo-vm') -replace '/c/','C:\') -replace '/','\'

mkdir $package_dir
mkdir $package_dir/image
mkdir $package_dir/Pharo

cp $ci_build_dir/TravisCI.image $package_dir/$PROJECT_NAME.image
cp $ci_build_dir/TravisCI.changes $package_dir/$PROJECT_NAME.changes
cp $ci_build_dir/*.sources $package_dir
cp $ci_build_dir/TravisCI.image $package_dir/image/$PROJECT_NAME.image
cp $ci_build_dir/TravisCI.changes $package_dir/image/$PROJECT_NAME.changes
cp $ci_build_dir/*.sources $package_dir/image

cp $vm_dir/*.dll $package_dir
cp $vm_dir/Pharo.exe $package_dir/$PROJECT_NAME.exe
cp $vm_dir/*.dll $package_dir/Pharo
cp $vm_dir/Pharo.exe $package_dir/Pharo
cp $vm_dir/PharoConsole.exe $package_dir/Pharo

& $vm_dir/PharoConsole.exe -headless $package_dir/$PROJECT_NAME.image eval --save "OPVersion currentWithRunId: $RUN_ID projectName: '$REPOSITORY_NAME'"
"start %~dp0Pharo\Pharo.exe %~dp0image\$PROJECT_NAME.image" | set-content "$package_dir/$PROJECT_NAME.bat"

& $vm_dir/PharoConsole.exe -headless $package_dir/image/$PROJECT_NAME.image eval --save "OPVersion currentWithRunId: $RUN_ID projectName: '$REPOSITORY_NAME'"

Compress-Archive -Path $package_dir -DestinationPath "$PROJECT_NAME-$PLATFORM-$VERSION.zip"
3 changes: 2 additions & 1 deletion .github/scripts/script.st
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
PharoLightTheme beCurrent.
PolymorphSystemSettings setDesktopLogoWith: OPIcons current logo asMorph.
Smalltalk at: #OPUmlClassEditorPlugin ifPresent: [ :plugin | plugin allDefaultProfiles ].
PolymorphSystemSettings setDesktopLogoWith: OPIcons current logo asMorph.
78 changes: 75 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
RUN_ID: ${{ github.run_id }}

jobs:

build-linux:
runs-on: ubuntu-latest
env:
Expand All @@ -46,6 +46,31 @@ jobs:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip

build-mac:
runs-on: macos-latest
env:
PLATFORM: mac
name: 'Build Mac'
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Load SmalltalkCI environment
uses: hpi-swa/[email protected]
id: smalltalkci
with:
smalltalk-version: Pharo64-9.0
- name: Prepare image and test
run: smalltalkci -s ${{ steps.smalltalkci.outputs.smalltalk-version }}
shell: bash
timeout-minutes: 10
- name: Create zip
run: chmod u+x .github/scripts/build-mac.sh; ./.github/scripts/build-mac.sh
- name: Cache zip
uses: actions/[email protected]
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip

build-win:
runs-on: windows-latest
env:
Expand Down Expand Up @@ -88,6 +113,23 @@ jobs:
if: steps.get-zip.outputs.cache-hit != 'true'
run: exit 1

check-mac-cache:
needs: build-mac
runs-on: macos-latest
name: 'Check Mac zip is created'
env:
PLATFORM: mac
steps:
- name: Get zip from cache
id: get-zip
uses: actions/[email protected]
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
- name: Fail on cache miss
if: steps.get-zip.outputs.cache-hit != 'true'
run: exit 1

check-win-cache:
needs: build-win
runs-on: windows-latest
Expand All @@ -106,7 +148,7 @@ jobs:
run: exit 1

create-release:
needs: [check-linux-cache, check-win-cache]
needs: [check-linux-cache, check-mac-cache, check-win-cache]
runs-on: ubuntu-latest
name: 'Re-create release'
steps:
Expand Down Expand Up @@ -147,6 +189,35 @@ jobs:
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
asset_content_type: application/zip

upload-mac-zip:
needs: create-release
runs-on: macos-latest
name: 'Upload Mac zip'
env:
PLATFORM: mac
steps:
- name: Get zip from cache
id: get-zip
uses: actions/[email protected]
with:
path: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
key: ${{ github.run_id }}-${{ github.run_number }}_${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
- name: Get Release by Tag
id: get_release_by_tag
uses: jonfriesen/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
- name: Upload zip
id: upload-zip
uses: actions/[email protected]
with:
upload_url: ${{ steps.get_release_by_tag.outputs.upload_url }}
asset_path: ./${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
asset_content_type: application/zip

upload-win-zip:
needs: create-release
runs-on: windows-latest
Expand Down Expand Up @@ -177,6 +248,7 @@ jobs:
asset_content_type: application/zip

create-dependent-matrix:
needs: [create-release]
runs-on: ubuntu-latest
name: 'Find dependent repositories'
if: ${{ github.event_name == 'push' || contains(github.event.inputs.build-dependent || false, 'true') }}
Expand All @@ -193,7 +265,7 @@ jobs:
run: echo "::set-output name=matrix::`cat ./.github/dependent-repositories.txt | tr -d " \t\n\r"`"

build-dependent:
needs: [check-linux-cache, check-win-cache, create-dependent-matrix]
needs: [create-dependent-matrix]
runs-on: ubuntu-latest
name: 'Build dependent'
if: ${{ contains(needs.create-dependent-matrix.outputs.matrix, '/') }}
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,35 @@ jobs:
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
asset_content_type: application/zip

mac:
runs-on: macos-latest
env:
PLATFORM: ${{ github.job }}
name: 'Build Mac and upload zip'
steps:
- uses: actions/[email protected]
- uses: hpi-swa/[email protected]
id: smalltalkci
with:
smalltalk-version: Pharo64-9.0
- name: Prepare image and test
run: smalltalkci -s ${{ steps.smalltalkci.outputs.smalltalk-version }}
shell: bash
timeout-minutes: 10
- name: Create zip
run: chmod u+x .github/scripts/build-mac.sh; ./.github/scripts/build-mac.sh
- name: Get release
id: get_release
uses: bruceadams/[email protected]
- name: Upload zip
id: upload-zip
uses: actions/[email protected]
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PLATFORM }}-${{ env.VERSION }}.zip
asset_content_type: application/zip

win:
runs-on: windows-latest
env:
Expand Down

0 comments on commit 0f2fe48

Please sign in to comment.