Skip to content

Commit

Permalink
Update job config
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaSimsic committed Oct 3, 2024
1 parent 21f7de9 commit e5e4810
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 35 deletions.
18 changes: 12 additions & 6 deletions .github/scripts/mxbuild.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,31 @@ RUN \
mkdir /usr/lib/jvm && \
tar xfz /tmp/openjdk.tar.gz --directory /usr/lib/jvm && \
rm /tmp/openjdk.tar.gz

RUN \
if [ -z "$MENDIX_VERSION_URL" ]; then \
echo "Downloading mxbuild ${MENDIX_VERSION}..." && \
wget -q https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz -O /tmp/mbuild.tar.gz; \
else \
if [ -n "$MENDIX_VERSION_URL" ]; then \
echo "Downloading mxbuild from provided URL..." && \
wget -q $MENDIX_VERSION_URL -O /tmp/mbuild.tar.gz; \
wget -q $MENDIX_VERSION_URL -O /tmp/mxbuild.tar.gz; \
else \
echo "Downloading mxbuild ${MENDIX_VERSION}..." && \
wget -q https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz -O /tmp/mxbuild.tar.gz; \
fi && \
mkdir /tmp/mxbuild && \
tar xfz /tmp/mxbuild.tar.gz --directory /tmp/mxbuild && \
rm /tmp/mxbuild.tar.gz

RUN \
apt-get -qq remove -y wget && \
apt-get clean

RUN \
echo "#!/bin/bash -x" >/bin/mxbuild && \
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 && \
chmod +x /bin/mxbuild

RUN \
echo "#!/bin/bash -x" >/bin/mx && \
echo "dotnet /tmp/mxbuild/modeler/mx.dll \$@" >>/bin/mx && \
chmod +x /bin/mx
chmod +x /bin/mx

ENV M2EE_TOOLS_JAR=/tmp/mxbuild/modeler/tools/m2ee-tools.jar
81 changes: 52 additions & 29 deletions .github/workflows/NativePipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,68 +91,77 @@ jobs:
mendix-version:
runs-on: ubuntu-22.04
outputs:
mendix_version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}
mendix_version_url: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION_URL }}
steps:
- name: "Check out code"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: "Get Mendix version"
uses: actions/checkout@v3
- name: "Get Mendix version from JSON"
id: get-mendix-version
if: ${{ github.event.inputs.mendix_version_url == '' }}
uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3 # v0.2.0
uses: notiz-dev/[email protected]
with:
path: configs/e2e/mendix-versions.json
prop_path: latest

- name: Use provided mx version
id: use-provided-mx-version
- name: Set Mendix version and URL
id: set-mendix-version
run: |
if [[ -z "${{ github.event.inputs.mendix_version_url }}" ]]; then
echo "MENDIX_VERSION=${{ steps.get-mendix-version.outputs.prop }}" >> $GITHUB_ENV
if [[ -n "${{ github.event.inputs.mendix_version_url }}" ]]; then
MENDIX_VERSION=$(basename ${{ github.event.inputs.mendix_version_url }} | sed 's/mxbuild-\(.*\)\.tar\.gz/\1/')
echo "MENDIX_VERSION=${MENDIX_VERSION}" >> $GITHUB_OUTPUT
echo "MENDIX_VERSION_URL=${{ github.event.inputs.mendix_version_url }}" >> $GITHUB_OUTPUT
else
echo "MENDIX_VERSION_URL=${{ github.event.inputs.mendix_version_url }}" >> $GITHUB_ENV
MENDIX_VERSION="${{ steps.get-mendix-version.outputs.prop }}"
echo "MENDIX_VERSION=${MENDIX_VERSION}" >> $GITHUB_OUTPUT
echo "MENDIX_VERSION_URL=https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz" >> $GITHUB_OUTPUT
fi
- name: "Debug Mendix Version"
run: |
echo "Mendix Version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}"
echo "Mendix Version URL: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION_URL }}"
docker-images:
needs: mendix-version
runs-on: ubuntu-22.04
steps:
- name: "Login to GitHub Container Registry"
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Check if docker image already exists"
run: |
docker manifest inspect ghcr.io/mendix/native-widgets/mxbuild:${{ env.MENDIX_VERSION }} || EXIT_CODE=$?
docker manifest inspect ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }} || EXIT_CODE=$?
echo "IMAGE_MISSING=$EXIT_CODE" >> $GITHUB_ENV
- name: "Check out code"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
uses: actions/checkout@v3
if: ${{ env.IMAGE_MISSING != 0 }}
- name: "Build mxbuild image"
if: ${{ env.IMAGE_MISSING != 0 }}
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
uses: docker/[email protected]
with:
file: ./.github/scripts/mxbuild.Dockerfile
context: ./.github/scripts
build-args: |
MENDIX_VERSION=${{ env.MENDIX_VERSION }}
MENDIX_VERSION_URL=${{ env.MENDIX_VERSION_URL }}
MENDIX_VERSION=${{ needs.mendix-version.outputs.mendix_version }}
MENDIX_VERSION_URL=${{ needs.mendix-version.outputs.mendix_version_url }}
push: true
tags: ghcr.io/mendix/native-widgets/mxbuild:${{ env.MENDIX_VERSION }}
secrets: GIT_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }}
tags: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }}
resources:
needs: scope
needs: [scope, mendix-version]
runs-on: ubuntu-22.04
permissions:
packages: read
contents: read
steps:
- name: "Check out code"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Set up node"
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn
Expand All @@ -165,7 +174,7 @@ jobs:
env:
NODE_OPTIONS: --max_old_space_size=6144
- name: "Upload resources artifact"
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
uses: actions/upload-artifact@v3
with:
name: resources
path: |
Expand All @@ -175,7 +184,11 @@ jobs:
project:
needs: [resources, mendix-version]
runs-on: ubuntu-22.04
container: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix-version }}
container:
image: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Make sure curl is installed"
run: |
Expand All @@ -184,14 +197,16 @@ jobs:
- name: "Download test project"
run: curl -L -o project.zip https://github.com/mendix/Native-Mobile-Resources/archive/refs/heads/main.zip
- name: "Extract test project"
uses: montudor/action-zip@0852c26906e00f8a315c704958823928d8018b28 # v1.0.0
uses: montudor/action-zip@v1
with:
args: unzip -qq project.zip
args: unzip -qq project.zip -d .
- name: "Download resources artifact"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
uses: actions/download-artifact@v3
with:
name: resources
path: resources
- name: "List resources"
run: ls -R resources
- name: "Move widgets"
shell: bash
run: |
Expand Down Expand Up @@ -224,7 +239,11 @@ jobs:
android-bundle:
needs: [project, mendix-version]
runs-on: ubuntu-22.04
container: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix-version }}
container:
image: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Check out code"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
Expand All @@ -240,7 +259,11 @@ jobs:
ios-bundle:
needs: [project, mendix-version]
runs-on: ubuntu-22.04
container: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix-version }}
container:
image: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Check out code"
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
Expand Down Expand Up @@ -408,7 +431,7 @@ jobs:
uses: ./.github/actions/start-runtime
with:
mda-file: automation.mda
mendix-version: ${{ needs.mendix-version.outputs.mendix-version }}
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }}
- name: "Download Android app"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
Expand Down Expand Up @@ -502,7 +525,7 @@ jobs:
uses: ./.github/actions/start-runtime
with:
mda-file: automation.mda
mendix-version: ${{ needs.mendix-version.outputs.mendix-version }}
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }}
- name: "Download iOS app"
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
Expand Down

0 comments on commit e5e4810

Please sign in to comment.