Skip to content

Commit

Permalink
Merge pull request #35 from maxkratz/feature/ci-cloud-runner
Browse files Browse the repository at this point in the history
Switch to Github-hosted runners
  • Loading branch information
maxkratz authored Apr 28, 2022
2 parents 2ec75f2 + 9f3b4d3 commit 1db12e2
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 49 deletions.
80 changes: 67 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,40 @@ on:
tags:
- 'v*.*.*'

env:
# Eclipse version to use in this CI
VERSION: "2021-12"

jobs:
# Create splash image
create-splash-image:
runs-on: [ubuntu-20.04]
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Start message
run: echo "Creating splash image for version $VERSION."
- name: Run splash creator script
run: chmod +x splash.sh && ./splash.sh img $VERSION
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: splash.bmp
path: splash.bmp

# Build Eclipse eMoflon Linux user
build-linux-user:
runs-on: [self-hosted, linux, x64]
needs: [create-splash-image]
runs-on: [ubuntu-20.04]
steps:
- name: Start message
run: echo "Started CI build (Eclipse eMoflon Linux user)."
- name: Check out repository code
uses: actions/checkout@v2
- name: Download splash image
uses: actions/download-artifact@v2
with:
name: splash.bmp
- name: Run build script
run: chmod +x build.sh && ./build.sh -m user -o linux
- name: Upload artifact
Expand All @@ -28,12 +53,17 @@ jobs:

# Build Eclipse eMoflon Linux dev
build-linux-dev:
runs-on: [self-hosted, linux, x64]
needs: [create-splash-image]
runs-on: [ubuntu-20.04]
steps:
- name: Start message
run: echo "Started CI build (Eclipse eMoflon Linux dev)."
- name: Check out repository code
uses: actions/checkout@v2
- name: Download splash image
uses: actions/download-artifact@v2
with:
name: splash.bmp
- name: Run build script
run: chmod +x build.sh && ./build.sh -m dev -o linux
- name: Upload artifact
Expand All @@ -44,7 +74,7 @@ jobs:

# Build Eclipse eMoflon Linux user CI
build-linux-user-ci:
runs-on: [self-hosted, linux, x64]
runs-on: [ubuntu-20.04]
steps:
- name: Start message
run: echo "Started CI build (Eclipse eMoflon Linux user CI)."
Expand All @@ -62,7 +92,7 @@ jobs:

# Build Eclipse eMoflon Linux dev CI
build-linux-dev-ci:
runs-on: [self-hosted, linux, x64]
runs-on: [ubuntu-20.04]
steps:
- name: Start message
run: echo "Started CI build (Eclipse eMoflon Linux dev CI)."
Expand All @@ -80,17 +110,29 @@ jobs:

# Build Eclipse eMoflon Windows user
build-windows-user:
runs-on: [self-hosted, windows, x64]
env:
WINDOWS_JDK_BIN_PATH: ${{ secrets.WINDOWS_JDK_BIN_PATH }}
needs: [create-splash-image]
runs-on: [windows-2022]
steps:
- name: Start message
run: echo "Started CI build (Eclipse eMoflon Windows user)."
- name: Install dependencies
run: |
choco install wget curl unzip zip --no-progress
- name: Install correct Java version
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '16'
- name: Fix Git line endings
run: git config --global core.autocrlf input
- name: Check out repository code
uses: actions/checkout@v2
- name: Download splash image
uses: actions/download-artifact@v2
with:
name: splash.bmp
- name: Run build script
run: |
echo "$env:WINDOWS_JDK_BIN_PATH" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
bash ./build.sh -m user -o windows
- name: Upload artifact
uses: actions/upload-artifact@v2
Expand All @@ -100,17 +142,29 @@ jobs:

# Build Eclipse eMoflon Windows dev
build-windows-dev:
runs-on: [self-hosted, windows, x64]
env:
WINDOWS_JDK_BIN_PATH: ${{ secrets.WINDOWS_JDK_BIN_PATH }}
needs: [create-splash-image]
runs-on: [windows-2022]
steps:
- name: Start message
run: echo "Started CI build (Eclipse eMoflon Windows dev)."
- name: Install dependencies
run: |
choco install wget curl unzip zip --no-progress
- name: Install correct Java version
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '16'
- name: Fix Git line endings
run: git config --global core.autocrlf input
- name: Check out repository code
uses: actions/checkout@v2
- name: Download splash image
uses: actions/download-artifact@v2
with:
name: splash.bmp
- name: Run build script
run: |
echo "$env:WINDOWS_JDK_BIN_PATH" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
bash ./build.sh -m dev -o windows
- name: Upload artifact
uses: actions/upload-artifact@v2
Expand All @@ -121,7 +175,7 @@ jobs:
# Create a release if running on tag
create-release:
needs: [build-linux-user, build-linux-dev, build-linux-user-ci, build-linux-dev-ci, build-windows-user, build-windows-dev]
runs-on: [self-hosted, linux, x64]
runs-on: [ubuntu-20.04]
# Only run on tags
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
Expand Down
33 changes: 8 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,18 @@ Download an archive for the version you are looking for from the release page an

## Runner requirements

In order to run the "Github Actions" pipeline you must ensure that you have at least one properly configured Linux and one Windows runner added to the Github project.
Currently, all actions are run by the cloud-hosted Github runners.
All required packages get installed by the CI confguration while running.

### Linux
In order to run the "Github Actions" pipeline on selfhosted runners, you must ensure that you have at least one properly configured Linux and one Windows runner added to the Github project.

Required packages:
Required packages (at least):
* `curl`
* `wget`
* `(un)tar`
* `tar`
* `zip`
* `OpenJDK 11.0.13` (may differ, as this is just used to boot-up Eclipse in headless mode)
* `AdoptJDK 16.0.2.7-hotspot` (may differ, as this is just used to boot-up Eclipse in headless mode)
* `imagemagick`
* `fonts-liberation`
* Github Actions runner

### Windows

Required packages:
* `WSL2` with, e.g., Debian as distribution. You have to install some packages inside it:
* `curl`
* `wget`
* `unzip`
* `zip`
* `imagemagick`
* `AdoptJDK 16.0.2.7-hotspot` (must exactly match or you have to adapt [ci.yml](.github/workflows/ci.yml))
* Github Actions runner

### Github secrets

To remove hardcoded values from the CI config ([ci.yml](.github/workflows/ci.yml))), this project uses [Github secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets).

| Name | Example value | Used for |
|-------------------------|--------------------------------------------------------------|-----------------------------------|
| WINDOWS_JDK_BIN_PATH | C:\Program Files\Eclipse Foundation\jdk-16.0.2.7-hotspot\bin | JDK path config (Windows runners) |
* WSL2 with, e.g., Debian as distribution (in case the runner is Windows-based)
15 changes: 10 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ done
# Config and URLs
#

VERSION="2021-12"
VERSION=$VERSION # version comes from the CI env
ARCHIVE_FILE_LINUX="eclipse-modeling-$VERSION-R-linux-gtk-x86_64.tar.gz"
ARCHIVE_FILE_WINDOWS="eclipse-modeling-$VERSION-R-win32-x86_64.zip"
OUTPUT_FILE_PREFIX_LINUX="eclipse-emoflon-linux"
Expand Down Expand Up @@ -104,9 +104,14 @@ setup_emoflon_headless_local_updatesite () {
unzip ./tmp/emoflon-headless/updatesite.zip -d tmp/emoflon-headless

# Append local folder to path (has to be absolute and, therefore, dynamic)
if [[ "$OS" = "linux" ]]; then
if [[ ! -z ${GITHUB_WORKSPACE} ]] && [[ "$OS" = "windows" ]]; then
log "Using a Github-hosted runner on Windows."
UPDATESITES+=",file:/D:/a/emoflon-eclipse-build/emoflon-eclipse-build/tmp/emoflon-headless/"
elif [[ "$OS" = "linux" ]]; then
log "Using a runner on Linux."
UPDATESITES+=",file://$PWD/tmp/emoflon-headless/"
elif [[ "$OS" = "windows" ]]; then
log "Using a runner on Windows."
UPDATESITES+=",file://$(echo $PWD | sed -e 's/\/mnt\///g' | sed -e 's/^\///' -e 's/\//\\/g' -e 's/^./\0:/')\tmp\emoflon-headless\\"
fi
}
Expand Down Expand Up @@ -176,13 +181,13 @@ done
# Install com.seeq.eclipse.importprojects (by hand because there is no public update site)
install_eclipse_import_projects

# Create and install custom splash image
# Deploy custom splash image
if [[ $SKIP_THEME -eq 1 ]]; then
# Skip UI customization for CI builds
log "Skipping custom splash image."
else
log "Create and install custom splash image."
chmod +x splash.sh && ./splash.sh $VERSION
log "Deploy custom splash image."
chmod +x splash.sh && ./splash.sh deploy
fi

log "Clean-up old archives and create new archive."
Expand Down
16 changes: 10 additions & 6 deletions splash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

set -e

VERSION=$1
convert ./resources/emoflon-splash_template.png -pointsize 24 -draw "gravity south fill white text 0,15 '${VERSION}'" splash.bmp
mkdir -p ./eclipse/plugins/org.emoflon.splash
mv splash.bmp ./eclipse/plugins/org.emoflon.splash
sed -i 's/org.eclipse.epp.package.common/org.emoflon.splash/g' ./eclipse/eclipse.ini
sed -i 's/osgi.splashPath=platform\\:\/base\/plugins\/org.eclipse.platform/osgi.splashPath=platform\\:\/base\/plugins\/org.emoflon.splash/g' ./eclipse/configuration/config.ini
MODE=$1
VERSION=$2
if [[ "$MODE" = "img" ]]; then
convert ./resources/emoflon-splash_template.png -font Liberation-Sans -pointsize 24 -draw "gravity south fill white text 0,15 '${VERSION}'" splash.bmp
elif [[ "$MODE" = "deploy" ]]; then
mkdir -p ./eclipse/plugins/org.emoflon.splash
mv splash.bmp ./eclipse/plugins/org.emoflon.splash
sed -i 's/org.eclipse.epp.package.common/org.emoflon.splash/g' ./eclipse/eclipse.ini
sed -i 's/osgi.splashPath=platform\\:\/base\/plugins\/org.eclipse.platform/osgi.splashPath=platform\\:\/base\/plugins\/org.emoflon.splash/g' ./eclipse/configuration/config.ini
fi

0 comments on commit 1db12e2

Please sign in to comment.