Skip to content

Commit ccdff01

Browse files
authored
Add native pipeline workflow (#33)
2 parents a2ff25b + 7cfb373 commit ccdff01

File tree

174 files changed

+1159
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+1159
-235
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Create native bundle"
2+
description: "Create a native bundle for android / iOS"
3+
inputs:
4+
platform:
5+
description: "Target platform (android or ios)"
6+
required: true
7+
mda-file:
8+
description: "Path to the deployment package"
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- name: "Make sure curl is installed"
14+
run: |
15+
apt update && apt upgrade -y
16+
apt install curl -y
17+
shell: bash
18+
- name: "Download test project"
19+
run: curl -L -o project.zip https://github.com/mendix/Native-Mobile-Resources/archive/refs/heads/main.zip
20+
shell: bash
21+
- name: "Extract test project"
22+
uses: montudor/action-zip@v1.0.0
23+
with:
24+
args: unzip -qq project.zip
25+
- name: "Extract deployment package"
26+
uses: montudor/action-zip@v1.0.0
27+
with:
28+
args: unzip -qq ${{ inputs.mda-file }} -d Native-Mobile-Resources-main/deployment
29+
- name: "Create bundle for ${{ inputs.platform }}"
30+
run: |
31+
mkdir -p ${{ inputs.platform }}/assets
32+
cd Native-Mobile-Resources-main/deployment/native && \
33+
/tmp/mxbuild/modeler/tools/node/linux-x64/node \
34+
/tmp/mxbuild/modeler/tools/node/node_modules/react-native/local-cli/cli.js \
35+
bundle --verbose --platform ${{ inputs.platform }} --dev false \
36+
--config "$PWD/metro.config.json" \
37+
--bundle-output $GITHUB_WORKSPACE/${{ inputs.platform }}/index.${{ inputs.platform }}.bundle \
38+
--assets-dest $GITHUB_WORKSPACE/${{ inputs.platform }}/assets/ \
39+
--entry-file ./index.js
40+
shell: bash
41+
env:
42+
NODE_OPTIONS: --max_old_space_size=6144
43+
- name: "Upload bundle for ${{ inputs.platform }}"
44+
uses: actions/upload-artifact@v3.1.2
45+
with:
46+
name: ${{ inputs.platform }}-bundle
47+
path: ${{ inputs.platform }}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: "Start the runtime"
2+
description: "Start the runtime in preparation of the native e2e tests"
3+
inputs:
4+
mda-file:
5+
description: "Path to the deployment package"
6+
required: true
7+
mendix-version:
8+
description: "Mendix version to use for the runtime"
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- name: "Setup Python"
14+
uses: actions/setup-python@v4.5.0
15+
with:
16+
python-version: "3.x"
17+
- name: "Install Python dependencies"
18+
run: pip install pyaml httplib2
19+
shell: bash
20+
- name: "Setup Java 11"
21+
id: setup-java
22+
uses: actions/setup-java@v3.10.0
23+
with:
24+
distribution: "temurin"
25+
java-version: "11"
26+
- name: "Extract deployment package"
27+
run: |
28+
mkdir project
29+
unzip -qq ${{ inputs.mda-file }} -d project
30+
cp configs/e2e/m2ee-native.yml project/m2ee-native.yml
31+
sed -i -- 's=$ROOT_PATH=${{ github.workspace }}=g' project/m2ee-native.yml
32+
sed -i -- 's=$JAVA_HOME=${{ steps.setup-java.outputs.path }}=g' project/m2ee-native.yml
33+
shell: bash
34+
- name: "Setup m2ee"
35+
run: |
36+
mkdir -p var/log var/opt/m2ee var/run bin tmp
37+
git clone https://github.com/KevinVlaanderen/m2ee-tools.git tmp/m2ee
38+
mv tmp/m2ee/src/* var/opt/m2ee
39+
chmod a=rwx var/log/ var/run/
40+
echo "#!/bin/bash -x" > bin/m2ee
41+
echo "python3 var/opt/m2ee/m2ee.py \$@" >>bin/m2ee
42+
chmod +x bin/m2ee
43+
shell: bash
44+
- name: "Setup mxruntime"
45+
run: |
46+
mkdir -p ${{ github.workspace }}/project/runtimes ${{ github.workspace }}/project/data/model-upload ${{ github.workspace }}/project/data/database ${{ github.workspace }}/project/data/files ${{ github.workspace }}/project/data/tmp
47+
wget -q https://cdn.mendix.com/runtime/mendix-${{ inputs.mendix-version }}.tar.gz -O tmp/runtime.tar.gz
48+
tar xfz tmp/runtime.tar.gz --directory ${{ github.workspace }}/project/runtimes
49+
rm tmp/runtime.tar.gz
50+
shell: bash
51+
- name: "Start mxruntime"
52+
run: bin/m2ee -c ${{ github.workspace }}/project/m2ee-native.yml --verbose --yolo start
53+
shell: bash

.github/scripts/mxbuild.Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM mcr.microsoft.com/dotnet/runtime:6.0
2+
ARG MENDIX_VERSION
3+
4+
RUN \
5+
echo "Installing Java..." && \
6+
apt-get -qq update && \
7+
apt-get -qq install -y wget libgdiplus && \
8+
wget -q https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz -O /tmp/openjdk.tar.gz && \
9+
mkdir /usr/lib/jvm && \
10+
tar xfz /tmp/openjdk.tar.gz --directory /usr/lib/jvm && \
11+
rm /tmp/openjdk.tar.gz
12+
RUN \
13+
echo "Downloading mxbuild ${MENDIX_VERSION}..." && \
14+
wget -q https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz -O /tmp/mxbuild.tar.gz && \
15+
mkdir /tmp/mxbuild && \
16+
tar xfz /tmp/mxbuild.tar.gz --directory /tmp/mxbuild && \
17+
rm /tmp/mxbuild.tar.gz
18+
RUN \
19+
apt-get -qq remove -y wget && \
20+
apt-get clean
21+
RUN \
22+
echo "#!/bin/bash -x" >/bin/mxbuild && \
23+
echo "dotnet /tmp/mxbuild/modeler/mxbuild.dll --java-home=/usr/lib/jvm/jdk-11.0.2 --java-exe-path=/usr/lib/jvm/jdk-11.0.2/bin/java \$@" >>/bin/mxbuild && \
24+
chmod +x /bin/mxbuild
25+
RUN \
26+
echo "#!/bin/bash -x" >/bin/mx && \
27+
echo "dotnet /tmp/mxbuild/modeler/mx.dll \$@" >>/bin/mx && \
28+
chmod +x /bin/mx

0 commit comments

Comments
 (0)