Skip to content

Commit

Permalink
Merge pull request #52 from ba-st/gem_launchpad_docker_image
Browse files Browse the repository at this point in the history
Docker images for GemStone/64
  • Loading branch information
gcotelli authored Nov 14, 2023
2 parents 129f6a4 + 240c4a5 commit 445ccb9
Show file tree
Hide file tree
Showing 34 changed files with 454 additions and 45 deletions.
1 change: 1 addition & 0 deletions .docker/gs64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gemstone.key
3 changes: 3 additions & 0 deletions .docker/gs64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM launchpad-gs64:sut

CMD [ "launchpad", "start", "greeter" , "--name=DJ", "--title=Mr." ]
151 changes: 151 additions & 0 deletions .docker/gs64/docker-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#!/usr/bin/env bash

readonly ANSI_BOLD="\\033[1m"
readonly ANSI_RED="\\033[31m"
readonly ANSI_GREEN="\\033[32m"
readonly ANSI_BLUE="\\033[34m"
readonly ANSI_RESET="\\033[0m"

function print_info() {
if [ -t 1 ]; then
printf "${ANSI_BOLD}${ANSI_BLUE}%s${ANSI_RESET}\\n" "$1"
else
echo "$1"
fi
}

function print_success() {
if [ -t 1 ]; then
printf "${ANSI_BOLD}${ANSI_GREEN}%s${ANSI_RESET}\\n" "$1"
else
echo "$1"
fi
}

function print_error() {
if [ -t 1 ]; then
printf "${ANSI_BOLD}${ANSI_RED}%s${ANSI_RESET}\\n" "$1" 1>&2
else
echo "$1" 1>&2
fi
}

function executeWithArguments() {
rm -rf logs out err
LAST_ARGUMENTS=$*
"$@" > out 2> err || true
}

function assertOutputIncludesMessage() {
local message=$1
local output=$2

if [ "$(grep -c "$message" "$output")" -eq 0 ]; then
print_error "Expected std$output to have: '$message' when invoked with $LAST_ARGUMENTS"
print_info "Output contents"
cat "$output"
exit 1
fi
}

set -e

print_info "Creating network"
if docker network inspect launchpad-net > /dev/null 2>&1 ;then
docker network rm launchpad-net
fi
docker network create --attachable launchpad-net

print_info "Starting stone"
if [[ ! -f "$PWD"/.docker/gs64/gemstone.key ]]; then
print_error "Missing $PWD/.docker/gs64/gemstone.key"
exit 1
fi

docker run --rm --detach --name gs64-stone \
-e TZ="America/Argentina/Buenos_Aires" \
--cap-add=SYS_RESOURCE \
--network=launchpad-net \
--volume="$PWD":/opt/gemstone/projects/Launchpad:ro \
--volume="$PWD"/.docker/gs64/gem.conf:/opt/gemstone/conf/gem.conf \
--volume="$PWD"/.docker/gs64/gemstone.key:/opt/gemstone/product/sys/gemstone.key:ro \
ghcr.io/ba-st/gs64-rowan:v3.7.0

sleep 1
print_info "Loading Launchpad in the stone"
docker exec -t -u gemstone gs64-stone ./load-rowan-project.sh Launchpad

print_info "Building base gem"
docker buildx build --tag launchpad-gs64:sut docker/gs64

print_info "Building examples gem"
docker buildx build \
--tag launchpad-examples-gs64:sut \
--file .docker/gs64/Dockerfile \
.

function run_launchpad_gem(){
executeWithArguments docker run \
-e TZ="America/Argentina/Buenos_Aires" \
-e GS64_STONE_HOSTNAME="gs64-stone" \
--cap-add=SYS_RESOURCE \
--network=launchpad-net \
--volume="$PWD"/.docker/gs64/gem.conf:/opt/gemstone/conf/gem.conf \
launchpad-examples-gs64:sut "$@"
}

print_info "Running basic test"
run_launchpad_gem
assertOutputIncludesMessage '[INFO]' out
assertOutputIncludesMessage "Hi Mr. DJ!" out
print_success "OK"

print_info "Running --version test"
run_launchpad_gem launchpad --version
assertOutputIncludesMessage "Launchpad" out
print_success "OK"

print_info "Running launchpad list test"
run_launchpad_gem launchpad list
assertOutputIncludesMessage "broken greeter" out
print_success "OK"

print_info "Running launchpad list --verbose test"
run_launchpad_gem launchpad list --verbose
assertOutputIncludesMessage "broken v0.0.1" out
assertOutputIncludesMessage "greeter v1.0.0" out
print_success "OK"

print_info "Running launchpad explain test"
run_launchpad_gem launchpad explain broken
assertOutputIncludesMessage "broken \[v0.0.1\] - A broken application" out
run_launchpad_gem launchpad explain greeter
assertOutputIncludesMessage "greeter \[v1.0.0\] - A greetings application" out
run_launchpad_gem launchpad explain
assertOutputIncludesMessage "\[ERROR\] Missing application name or option." err
print_success "OK"

print_info "Running launchpad start greeter test"
run_launchpad_gem launchpad start greeter --name=Juan
assertOutputIncludesMessage "Hi Juan!" out
print_success " Just name, OK"
run_launchpad_gem launchpad start greeter --name=Julia --title=Miss
assertOutputIncludesMessage "Hi Miss Julia!" out
print_success " Name and title, OK"
run_launchpad_gem launchpad start greeter --title=Miss
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err
print_success " Missing name, OK"
run_launchpad_gem launchpad start greeter
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err
print_success "OK"

print_info "Running launchpad start broken test"
run_launchpad_gem launchpad start broken --raise-error
assertOutputIncludesMessage "\[INFO\] Obtaining configuration... \[DONE\]" out
assertOutputIncludesMessage "\[ERROR\] Unexpected startup error: \"Doh!\"" err
print_success "OK"

print_info "Stopping stone"
docker stop gs64-stone
print_info "Removing network"
docker network rm launchpad-net
2 changes: 2 additions & 0 deletions .docker/gs64/gem.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GEM_TEMPOBJ_CACHE_SIZE = 500000KB;

File renamed without changes.
4 changes: 2 additions & 2 deletions .docker/docker-tests.sh → .docker/pharo/docker-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ function assertOutputIncludesMessage() {
set -e

print_info "Building base image"
docker buildx build --tag launchpad:sut docker
docker buildx build --tag launchpad:sut docker/pharo

print_info "Building examples image"
docker buildx build \
--tag launchpad-examples:sut \
--file .docker/Dockerfile \
--file .docker/pharo/Dockerfile \
.

print_info "Running basic test"
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/.binary-stack-serialization.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
name: Binary Stack Serialization Tests

on: [push,pull_request,workflow_dispatch]

on:
- push
- pull_request
- workflow_dispatch
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0 ]
smalltalk:
- Pharo64-11
- Pharo64-10
- Pharo64-9.0
- Pharo64-8.0
name: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@v3
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/docker-build-gs64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Publish GS64 Docker Images
on:
workflow_dispatch:
push:
branches:
- '**'
tags:
- 'v*.*.*'
pull_request:
jobs:
build_and_publish:
runs-on: ubuntu-latest
name: Build and Publish Docker images
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/launchpad-gs64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Docker build and push
uses: docker/build-push-action@v5
with:
context: ./docker/gs64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
secrets: GIT_AUTH_TOKEN=${{ secrets.DOCKER_REGISTRY_TOKEN }}
12 changes: 5 additions & 7 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build and Publish Docker Images

name: Build and Publish Pharo Docker Images
on:
workflow_dispatch:
push:
Expand All @@ -8,7 +7,6 @@ on:
tags:
- 'v*.*.*'
pull_request:

jobs:
build_and_publish:
runs-on: ubuntu-latest
Expand All @@ -18,22 +16,22 @@ jobs:
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/launchpad
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Docker build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: ./docker
context: ./docker/pharo
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/docker-tests-gs64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: GS64 Docker Tests
on:
- push
- pull_request
- workflow_dispatch
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Configure keyfile
run: |
echo "$GS_KEYFILE" > ./.docker/gs64/gemstone.key
env:
GS_KEYFILE: ${{ secrets.GS_KEYFILE }}
- name: Run tests using Docker
run: ./.docker/gs64/docker-tests.sh
- name: Remove keyfile
run: rm -f ./.docker/gs64/gemstone.key
11 changes: 6 additions & 5 deletions .github/workflows/docker-tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Docker Tests

on: [push,pull_request,workflow_dispatch]

name: Pharo Docker Tests
on:
- push
- pull_request
- workflow_dispatch
jobs:
unit-tests:
runs-on: ubuntu-latest
Expand All @@ -10,4 +11,4 @@ jobs:
with:
fetch-depth: 2
- name: Run tests using Docker
run: ./.docker/docker-tests.sh
run: ./.docker/pharo/docker-tests.sh
18 changes: 13 additions & 5 deletions .github/workflows/loading-groups.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
name: Baseline Groups

on: [push,pull_request,workflow_dispatch]

on:
- push
- pull_request
- workflow_dispatch
jobs:
group-loading:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
smalltalk: [ Pharo64-11, Pharo64-10, Pharo64-9.0, Pharo64-8.0 ]
load-spec: [ deployment, examples, tools, sunit, development]
smalltalk:
- Pharo64-10
- Pharo64-11
load-spec:
- development
- deployment
- examples
- sunit
- tools
name: ${{ matrix.smalltalk }} + ${{ matrix.load-spec }}
steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/loading-gs64-components.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'GS64 Components Loading'
on:
- push
- pull_request
- workflow_dispatch
jobs:
component-loading:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
load-spec:
- Deployment
name: GS64 + ${{ matrix.load-spec }}
steps:
- uses: actions/checkout@v3
- name: Load component in image
uses: ba-st-actions/gs64-ci@v2
with:
project_name: 'Launchpad'
load_spec: 'Launchpad-${{ matrix.load-spec }}'
5 changes: 4 additions & 1 deletion .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Markdown Lint
on: [push,pull_request,workflow_dispatch]
on:
- push
- pull_request
- workflow_dispatch
jobs:
remark-lint:
name: runner / markdownlint
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Release Notifications

on:
release:
types: [published]

on: workflow_dispatch
jobs:
notify:
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 445ccb9

Please sign in to comment.