Skip to content

Commit

Permalink
Add custom SP version selection instead of url
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaSimsic committed Oct 9, 2024
1 parent 2abed06 commit bf2a446
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 33 deletions.
10 changes: 2 additions & 8 deletions .github/scripts/mxbuild.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM mcr.microsoft.com/dotnet/runtime:8.0
ARG MENDIX_VERSION
ARG MENDIX_VERSION_URL

RUN \
echo "Installing Java..." && \
Expand All @@ -12,13 +11,8 @@ RUN \
rm /tmp/openjdk.tar.gz

RUN \
if [ -n "$MENDIX_VERSION_URL" ]; then \
echo "Downloading mxbuild from provided URL..." && \
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 && \
echo "Downloading mxbuild ${MENDIX_VERSION}..." && \
wget -q https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz -O /tmp/mxbuild.tar.gz && \
mkdir /tmp/mxbuild && \
tar xfz /tmp/mxbuild.tar.gz --directory /tmp/mxbuild && \
rm /tmp/mxbuild.tar.gz
Expand Down
42 changes: 17 additions & 25 deletions .github/workflows/NativePipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Run Native Pipeline
on:
workflow_dispatch:
inputs:
mendix_version_url:
description: "Provide the url of SP to be used in job (Full path to mxbuild.tar.gz)"
mendix_version:
description: "Provide the SP version to be used (e.g., 10.14.0.43709). If empty, latest defined version from Mendix versions.json will be used."
required: false
default: ""

Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "scope=--since --include '*-native'" >> $GITHUB_OUTPUT
else
echo "scope=--include '*-native' --all" >> $GITHUB_OUTPUT
echo "scope=--all--include '*-native'" >> $GITHUB_OUTPUT
fi
fi
Expand All @@ -93,40 +93,33 @@ jobs:
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@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
- name: "Get Mendix version from JSON"
id: get-mendix-version
if: ${{ github.event.inputs.mendix_version_url == '' }}
uses: notiz-dev/[email protected]
uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3 # v0.2.0
with:
path: configs/e2e/mendix-versions.json
prop_path: latest
- name: Set Mendix version and URL
- name: Set Mendix version
id: set-mendix-version
run: |
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
if [[ -n "${{ github.event.inputs.mendix_version }}" ]]; then
echo "MENDIX_VERSION=${{ github.event.inputs.mendix_version }}" >> $GITHUB_OUTPUT
else
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
echo "MENDIX_VERSION=${{ steps.get-mendix-version.outputs.prop }}" >> $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/[email protected]
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -136,17 +129,16 @@ jobs:
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@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
if: ${{ env.IMAGE_MISSING != 0 }}
- name: "Build mxbuild image"
if: ${{ env.IMAGE_MISSING != 0 }}
uses: docker/[email protected]
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
file: ./.github/scripts/mxbuild.Dockerfile
context: ./.github/scripts
build-args: |
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:${{ needs.mendix-version.outputs.mendix_version }}
resources:
Expand All @@ -157,11 +149,11 @@ jobs:
contents: read
steps:
- name: "Check out code"
uses: actions/checkout@v3
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
fetch-depth: 0
- name: "Set up node"
uses: actions/setup-node@v3
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version-file: .nvmrc
cache: yarn
Expand All @@ -174,7 +166,7 @@ jobs:
env:
NODE_OPTIONS: --max_old_space_size=6144
- name: "Upload resources artifact"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: resources
path: |
Expand All @@ -197,11 +189,11 @@ 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@v1
uses: montudor/action-zip@0852c26906e00f8a315c704958823928d8018b28 # v1.0.0
with:
args: unzip -qq project.zip -d .
- name: "Download resources artifact"
uses: actions/download-artifact@v3
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: resources
path: resources
Expand Down

0 comments on commit bf2a446

Please sign in to comment.