Skip to content

[MOO-1887] Improve "Start runtime" and upgrade config #293

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
40 changes: 40 additions & 0 deletions .github/actions/archive-test-results/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Archive Test Results
description: Archive runtime logs, screenshots, and artifacts from test runs
inputs:
platform:
description: Platform (android or ios)
required: true
test-type:
description: Test type (widget name or js-actions)
required: true
workspace-path:
description: Workspace path for artifacts
required: false
default: ${{ github.workspace }}

runs:
using: composite
steps:
- name: Archive runtime logs
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
if: always()
with:
name: ${{ inputs.platform }}-runtime-logs-${{ inputs.test-type }}
path: log/*.log
if-no-files-found: ignore

- name: Archive test screenshots
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
if: always()
with:
name: ${{ inputs.platform }}-screenshots-${{ inputs.test-type }}
path: ${{ inputs.workspace-path }}/maestro/images/actual/${{ inputs.platform }}/**/*.png
if-no-files-found: ignore

- name: Archive artifacts
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #v4
if: always()
with:
name: ${{ inputs.platform }}-artifacts-${{ inputs.test-type }}
path: packages/pluggableWidgets/**/artifacts/
if-no-files-found: ignore
21 changes: 21 additions & 0 deletions .github/actions/setup-maestro/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Setup Maestro"
description: "Install and cache Maestro"
runs:
using: "composite"
steps:
- name: "Cache Maestro"
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: $HOME/.local/bin/maestro
key: maestro-${{ runner.os }}-v1

- name: "Install Maestro"
shell: bash
run: |
if [ ! -f "$HOME/.local/bin/maestro/bin/maestro" ]; then
mkdir -p $HOME/.local/bin
curl -L "https://github.com/mobile-dev-inc/maestro/releases/latest/download/maestro.zip" -o maestro.zip
unzip maestro.zip -d $HOME/.local/bin
chmod +x $HOME/.local/bin/maestro/bin/maestro
fi
echo "$HOME/.local/bin" >> $GITHUB_PATH
28 changes: 28 additions & 0 deletions .github/actions/setup-node-with-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Setup Node with Cached Dependencies'
description: 'Set up Node.js and install dependencies with caching'
runs:
using: 'composite'
steps:
- name: "Set up node"
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version-file: .nvmrc

- name: "Setup pnpm"
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4
- name: "Get pnpm store directory"
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: "Setup cache"
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: "Install dependencies"
run: pnpm install --frozen-lockfile
shell: bash
10 changes: 10 additions & 0 deletions .github/actions/setup-python/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Setup Python Common"
description: "Setup Python and install dependencies"
runs:
using: "composite"
steps:
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.12'
- run: pip install PyYAML httplib2
shell: bash
42 changes: 42 additions & 0 deletions .github/actions/setup-tools/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Setup Tools"
description: "Common setup for widget and js test jobs"
inputs:
mendix_version:
description: "Mendix version"
required: true
outputs:
java-path:
description: "Path to the installed Java"
value: ${{ steps.setup-java.outputs.path }}
runs:
using: "composite"
steps:
- name: "Setup Python and dependencies"
uses: ./.github/actions/setup-python

- name: "Setup Node and dependencies"
uses: ./.github/actions/setup-node-with-cache

- name: "Setup Java 21"
id: setup-java
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4
with:
distribution: "temurin"
java-version: "21"

- name: "Cache Mendix runtime"
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
with:
path: tmp/runtime.tar.gz
key: mendix-runtime-${{ inputs.mendix_version }}

- name: "Cache m2ee-tools"
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
with:
path: tmp/m2ee
key: m2ee-tools-v1

- name: "Install Maestro"
uses: ./.github/actions/setup-maestro


14 changes: 14 additions & 0 deletions .github/actions/setup-xcode-cli-tools/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Setup Xcode CLI Tools"
description: "Ensure Xcode CLI tools are configured"
runs:
using: "composite"
steps:
- name: "Verify and set Xcode CLI tools"
shell: bash
run: |
if ! xcode-select --print-path; then
echo "Xcode CLI tools not set. Setting them now."
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
else
echo "Xcode CLI tools are already configured."
fi
51 changes: 0 additions & 51 deletions .github/actions/start-runtime/action.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/actions/use-arficats-from-specific-run/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Download Artifact from Specific Run"
description: "Download an artifact from a specific workflow run using GitHub CLI"
inputs:
artifact_name:
description: "Name of the artifact to download"
required: true
run_id:
description: "Workflow run ID"
required: true
output_dir:
description: "Directory to extract the artifact"
required: true
platform:
description: "Platform (android or ios)"
required: true
runs:
using: "composite"
steps:
- name: "Install GitHub CLI"
shell: bash
run: |
if ! command -v gh &> /dev/null; then
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt update
sudo apt install -y gh
elif [[ "$RUNNER_OS" == "macOS" ]]; then
brew install gh
fi
fi
- name: "Authenticate GitHub CLI"
shell: bash
run: |
unset GITHUB_TOKEN
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: "Fetch artifact URL"
id: fetch-artifacts
shell: bash
run: |
url=$(gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts" --jq '.artifacts[] | select(.name == "${{ inputs.artifact_name }}") | .archive_download_url')
echo "artifacts_url=$url" >> $GITHUB_ENV
- name: "Download and extract artifact"
if: env.artifacts_url != ''
shell: bash
run: |
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o ${{ inputs.platform }}-app.zip "$artifacts_url"
unzip ${{ inputs.platform }}-app.zip -d ${{ inputs.output_dir }}
13 changes: 9 additions & 4 deletions .github/scripts/setup-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ sed -i -- "s=\$ROOT_PATH=$WORKSPACE=g" project/m2ee-native.yml
sed -i -- "s=\$JAVA_HOME=$JAVA_PATH=g" project/m2ee-native.yml

mkdir -p var/log var/opt/m2ee var/run bin tmp
git clone https://github.com/KevinVlaanderen/m2ee-tools.git tmp/m2ee
# Clone m2ee-tools only if not cached
if [ ! -d tmp/m2ee ]; then
git clone https://github.com/KevinVlaanderen/m2ee-tools.git tmp/m2ee
fi
mv tmp/m2ee/src/* var/opt/m2ee
chmod a=rwx var/log/ var/run/
echo "#!/bin/bash -x" > bin/m2ee
echo "python3 var/opt/m2ee/m2ee.py \$@" >>bin/m2ee
chmod +x bin/m2ee

# Download only if not cached
mkdir -p "$WORKSPACE/project/runtimes" "$WORKSPACE/project/data/model-upload" "$WORKSPACE/project/data/database" "$WORKSPACE/project/data/files" "$WORKSPACE/project/data/tmp"
wget -q "https://cdn.mendix.com/runtime/mendix-$MENDIX_VERSION.tar.gz" -O tmp/runtime.tar.gz
tar xfz tmp/runtime.tar.gz --directory "$WORKSPACE/project/runtimes"
rm tmp/runtime.tar.gz
if [ ! -f tmp/runtime.tar.gz ]; then
wget -q "https://cdn.mendix.com/runtime/mendix-$MENDIX_VERSION.tar.gz" -O tmp/runtime.tar.gz
fi
tar xfz tmp/runtime.tar.gz --directory "$WORKSPACE/project/runtimes"
33 changes: 33 additions & 0 deletions .github/scripts/start-runtime-with-verification.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e

# Arguments
MDA_FILE="$1"
MENDIX_VERSION="$2"
JAVA_PATH="$3"
WORKSPACE="$4"

# Ensure setup script is executable
chmod +x .github/scripts/setup-runtime.sh

# Run setup
.github/scripts/setup-runtime.sh "$MDA_FILE" "$MENDIX_VERSION" "$JAVA_PATH" "$WORKSPACE"

# Stop any running Mendix runtime before starting a new one
if bin/m2ee -c "$WORKSPACE/project/m2ee-native.yml" status | grep -q "running"; then
echo "Stopping previous Mendix runtime..."
bin/m2ee -c "$WORKSPACE/project/m2ee-native.yml" stop
sleep 10
fi

# Start runtime
START_OUTPUT=$(bin/m2ee -c "$WORKSPACE/project/m2ee-native.yml" --verbose --yolo start 2>&1)
echo "Full output from start command:"
echo "$START_OUTPUT"
if [ $? -eq 0 ]; then
echo "Runtime started successfully (exit code)."
exit 0
fi

echo "Runtime did not start successfully."
exit 1
Loading
Loading