Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for GitHub Actions #22

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: Bundle

on:
push: # All branches, but appropriate paths only.
# branches:
# - squeak-trunk
# - squeak-5.3
# - squeak-5.2
paths-ignore:
- '**.md' # Skip changes in documentation artifacts
pull_request:
branches:
- squeak-trunk
# - squeak-5.3
# - squeak-5.2
paths-ignore:
- '**.md'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we build on pushes to every branch, why do we need double builds for every PR then?

Copy link
Member Author

@marceltaeumel marceltaeumel Sep 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both push and pull_request should have the same filter. Please read my comments above. This is due to being able to try out the builds in my fork. The one who merges this PR still has to do changes to afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was rather questioning the existence of either push or pull_request in general. :-) I am usually going with just push to any branch. Or wouldn't this work for forks then?

schedule:
- cron: '0 0 * * *' # Build everyday at midnight
workflow_dispatch:

jobs:
prepare-image:
strategy:
fail-fast: true
matrix:
smalltalk:
- Squeak-trunk
- Squeak64-trunk
# - Squeak-5.3
# - Squeak64-5.3
# - Squeak-5.2
# - Squeak64-5.2
runs-on: windows-latest
name: 🛠 Prepare image for ${{ matrix.smalltalk }}
env:
SMALLTALK_VERSION: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@v2

- name: Prepare image
shell: bash
run: ./prepare_image.sh
timeout-minutes: 20

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.smalltalk }}
path: |
tmp/*.sources
tmp/*.image
tmp/*.changes
tmp/version.sh
!tmp/Test*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of interest, where is the 90-day limit you mention indicated? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the repository settings. Only visible for admins.



test-image:
needs: [prepare-image]
strategy:
fail-fast: true
matrix:
smalltalk:
- Squeak-trunk
- Squeak64-trunk
# - Squeak-5.3
# - Squeak64-5.3
# - Squeak-5.2
# - Squeak64-5.2
runs-on: windows-latest
name: 🧪 Test image of ${{ matrix.smalltalk }}
env:
SMALLTALK_VERSION: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ${{ matrix.smalltalk }}
path: tmp

- name: "Set up SmalltalkCI"
# uses: hpi-swa/setup-smalltalkCI@v1
uses: marceltaeumel/setup-smalltalkCI@marceltaeumel/install-path
with:
smalltalk-image: ${{ matrix.smalltalk }}
smalltalkCI-workspace: ${{ github.workspace }}

- name: "Run tests"
continue-on-error: true
shell: bash
run: ./test_image.sh
timeout-minutes: 20

- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.smalltalk }}-tests
path: tmp/*.xml


prepare-bundles:
needs: [prepare-image]
strategy:
fail-fast: true
matrix:
smalltalk:
- Squeak-trunk
- Squeak64-trunk
# - Squeak-5.3
# - Squeak64-5.3
# - Squeak-5.2
# - Squeak64-5.2
runs-on: macos-latest
name: 📦 Prepare bundles for ${{ matrix.smalltalk }}
env:
SMALLTALK_VERSION: ${{ matrix.smalltalk }}
GIT_BRANCH: ${{ github.ref }}
DEPLOYMENT_BRANCH: squeak-trunk

ENCRYPTED_KEY: ${{ secrets.ENCRYPTED_KEY }}
ENCRYPTED_IV: ${{ secrets.ENCRYPTED_IV }}
PUBLIC_KEY: ${{ secrets.PUBLIC_KEY }}

PROXY_PORT: ${{ secrets.PROXY_PORT }}
PROXY_HOST: ${{ secrets.PROXY_HOST }}
PROXY_USER: ${{ secrets.PROXY_USER }}
UPSTREAM_HOST: ${{ secrets.UPSTREAM_HOST }}
UPSTREAM_USER: ${{ secrets.UPSTREAM_USER }}

CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
SIGN_IDENTITY: ${{ secrets.SIGN_IDENTITY }}
NOTARIZATION_USER: ${{ secrets.NOTARIZATION_USER }}
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}

steps:
- uses: actions/checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: ${{ matrix.smalltalk }}
path: tmp

- run: ./prepare_bundles.sh

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.smalltalk }}-bundles
path: product/*

- run: ./deploy_bundles.sh
if: endsWith(github.ref, env.DEPLOYMENT_BRANCH)
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# The Squeak/Smalltalk Programming System

[![Build Status](https://travis-ci.com/squeak-smalltalk/squeak-app.svg?branch=squeak-trunk)](https://travis-ci.com/squeak-smalltalk/squeak-app)

This is the code repository for Squeak's build system.

A build works basically as follows. The [prepare.sh](prepare.sh) script downloads VMs from http://files.squeak.org/base/ and then invokes the following scripts:

* [prepare_image.sh](prepare_image.sh) downloads a base image/changes/sources from http://files.squeak.org/base/
* [prepare_image.st](prepare_image.st) updates the image and creates a `version.sh` file with the version information
* [prepare_aio.sh](prepare_aio.sh) builds the All-In-One
* [prepare_mac.sh](prepare_mac.sh) builds the Mac release
* [prepare_win.sh](prepare_win.sh) builds the Windows release
* [prepare_lin.sh](prepare_lin.sh) builds the Linux x86 release
* [prepare_armv6.sh](prepare_armv6.sh) builds the Linux ARM release

Finally, [prepare.sh](prepare.sh) uploads everything to http://files.squeak.org/
(e.g. bleeding-edge trunk builds go to http://files.squeak.org/trunk).
# The Squeak/Smalltalk Programming System

[![Build Status](https://github.com/squeak-smalltalk/squeak-app/actions/workflows/bundle.yml/badge.svg)](https://github.com/squeak-smalltalk/squeak-app/actions/workflows/bundle.yml)

This is the code repository for Squeak's build system.

A build works basically as follows. First, 32-bit and 64-bit images are prepared and tested:

* [prepare_image.sh](prepare_image.sh) downloads a base image/changes/sources from http://files.squeak.org/base/
* [prepare_image.st](prepare_image.st) updates the image and creates a `version.sh` file with the version information
* [test_image.sh](test_image.sh) uses [smalltalkCI](https://github.com/hpi-swa/smalltalkCI) to run all tests and document the results

Second, the [prepare-bundles.sh](prepare-bundles.sh) script downloads VMs from http://files.squeak.org/base/ and then creates the bundles through the following scripts:

* [prepare_aio.sh](prepare_aio.sh) builds the All-In-One
* [prepare_mac.sh](prepare_mac.sh) builds the Mac release
* [prepare_win.sh](prepare_win.sh) builds the Windows release
* [prepare_lin.sh](prepare_lin.sh) builds the Linux x86 release
* [prepare_armv6.sh](prepare_armv6.sh) builds the Linux ARM release

Finally, [deploy_bundles.sh](deploy_bundles.sh) uploads everything to http://files.squeak.org/
(e.g., bleeding-edge trunk builds go to http://files.squeak.org/trunk).
58 changes: 58 additions & 0 deletions deploy_bundles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
################################################################################
# PROJECT: Squeak Bundle Generation
# FILE: deploy_bundles.sh
# CONTENT: Upload all bundles to files.squeak.org
#
# AUTHORS: Fabio Niephaus, Hasso Plattner Institute, Potsdam, Germany
# Marcel Taeumel, Hasso Plattner Institute, Potsdam, Germany
################################################################################

set -o errexit

[[ -z "${ENCRYPTED_DIR}" ]] && exit 4
[[ -z "${PRODUCT_DIR}" ]] && exit 5

source env_vars

readonly TARGET_BASE="/var/www/files.squeak.org"

begin_group "...uploading all files to files.squeak.org.."

if ! is_dir "${ENCRYPTED_DIR}"; then
echo "Failed to locate decrypted files."
exit 1
fi

if is_etoys; then
TARGET_PATH="${TARGET_BASE}/etoys/${SQUEAK_VERSION/Etoys/}"
else
TARGET_PATH="${TARGET_BASE}/${SQUEAK_VERSION/Squeak/}"
fi
TARGET_PATH="${TARGET_PATH}/${IMAGE_NAME}"

chmod 600 "${ENCRYPTED_DIR}/ssh_deploy_key"
ssh-keyscan -t ecdsa-sha2-nistp256 -p "${PROXY_PORT}" "${PROXY_HOST}" 2>&1 | tee -a "${HOME}/.ssh/known_hosts" > /dev/null;
echo "${UPSTREAM_HOST} ecdsa-sha2-nistp256 ${PUBLIC_KEY}" | tee -a "${HOME}/.ssh/known_hosts" > /dev/null;
rsync -rvz --ignore-existing -e "ssh -o ProxyCommand='ssh -l ${PROXY_USER} -i ${ENCRYPTED_DIR}/ssh_deploy_key -p ${PROXY_PORT} -W %h:%p ${PROXY_HOST}' -l ${UPSTREAM_USER} -i ${ENCRYPTED_DIR}/ssh_deploy_key" "${PRODUCT_DIR}/" "${UPSTREAM_HOST}:${TARGET_PATH}/";

end_group

begin_group "...updating latest symlinks on server..."

LATEST_PREFIX="${TARGET_BASE}/nightly/Squeak-latest-${IMAGE_BITS}bit"
SYMS_CMD="ln -f -s ${TARGET_PATH}/${IMAGE_NAME}.zip ${LATEST_PREFIX}.zip"
SYMS_CMD="${SYMS_CMD} && ln -f -s ${TARGET_PATH}/${BUNDLE_NAME_LIN}.zip ${LATEST_PREFIX}-Linux.zip"
SYMS_CMD="${SYMS_CMD} && ln -f -s ${TARGET_PATH}/${BUNDLE_NAME_MAC}.dmg ${LATEST_PREFIX}-macOS.dmg"
SYMS_CMD="${SYMS_CMD} && ln -f -s ${TARGET_PATH}/${BUNDLE_NAME_WIN}.zip ${LATEST_PREFIX}-Windows.zip"
if is_32bit; then
SYMS_CMD="${SYMS_CMD} && ln -f -s ${TARGET_PATH}/${BUNDLE_NAME_ARM}.zip ${LATEST_PREFIX}-ARMv6.zip"
fi
ssh -o ProxyCommand="ssh -l ${PROXY_USER} -i ${ENCRYPTED_DIR}/ssh_deploy_key -p ${PROXY_PORT} -W %h:%p ${PROXY_HOST}" \
-l "${UPSTREAM_USER}" -i "${ENCRYPTED_DIR}/ssh_deploy_key" "${UPSTREAM_HOST}" -t "${SYMS_CMD}"

end_group

# Remove sensitive information
rm -rf "${ENCRYPTED_DIR}"
security delete-keychain "${KEY_CHAIN}"
14 changes: 14 additions & 0 deletions env_vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
readonly HOME_DIR="$(pwd)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you named this file with a .env suffix, editors such as VS Code could display them more conveniently, I think. :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a source file. Same approach as in smalltalkCI. Maybe I should rename it? It's not even "export". Hmm...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd vote for renaming it. For instance, I do not get shellcheck or syntax highlighting in VS Code if the file does not have a suffix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just env is a very popular choice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, let's measure this! :-)

glob pattern hits on public GitHub repositories
env 2.8k
*.env 29.1k
?*env 12.5k
env_* 0.635k

So I guess anything but a file name ending in _env would be "popular". And VS Code should probably detect just env as environment variables, too. :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because it is hacktober, FYI: mikestead/vscode-dotenv#28 🙃

readonly TMP_DIR="${HOME_DIR}/tmp"

readonly FILES_BASE="http://files.squeak.org/base"
readonly RELEASE_URL="${FILES_BASE}/${SMALLTALK_VERSION/Etoys/Squeak}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there an Etoys?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still support for building Etoys bundles. See http://files.squeak.org/etoys/ . It uses the same base files from files.squeak.org/base. So, you have to replace "Etoys" with "Squeak" when building for "Etoys-trunk" or "Etoys64-trunk".

readonly IMAGE_URL="${RELEASE_URL}/base.zip"

readonly VM_BASE="${RELEASE_URL}"

# version.sh file produced by image
readonly VERSION_FILE="${TMP_DIR}/version.sh"

readonly ICONS_DIR="${HOME_DIR}/icons"
readonly RELEASE_NOTES_DIR="${HOME_DIR}/release-notes"
Loading