Skip to content
Merged
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
3 changes: 2 additions & 1 deletion packages/atlas-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"testProject": {
"githubUrl": "https://github.com/mendix/Atlas-Design-System",
"branchName": "lts/9.24"
"branchName": "lts/9.24",
"mxVersion": "9.24.0.2965"
},
"scripts": {
"build:module": "ts-node ./scripts/build.ts build",
Expand Down
3 changes: 2 additions & 1 deletion packages/atlas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Mendix Atlas UI is the foundation of making beautiful apps with Mendix. For more information about the framework go to https://atlas.mendix.com.",
"testProject": {
"githubUrl": "https://github.com/mendix/Atlas-Design-System",
"branchName": "main"
"branchName": "main",
"mxVersion": "9.24.0.2965"
},
"scripts": {
"build": "node ./scripts/build.js",
Expand Down
7 changes: 3 additions & 4 deletions packages/atlas/scripts/e2e.playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ main().catch(e => {
});

async function main() {
const mendixVersion = await getMendixVersion();

try {
execSync("docker info");
} catch (e) {
Expand All @@ -24,6 +22,7 @@ async function main() {

const packageConf = JSON.parse(await readFile("package.json"));
const widgetVersion = packageConf?.version;
const mendixVersion = packageConf?.testProject?.mxVersion;

// Downloading test project
if (process.argv.includes("--update-test-project") || ls(`tests/testProject/*.mpr`).length === 0) {
Expand Down Expand Up @@ -79,7 +78,7 @@ async function main() {
execSync(
`docker run --name mxbuild -t -v ${process.cwd()}:/source ` +
`--rm mxbuild:${mendixVersion} bash -c "mx update-widgets --loose-version-check /source/${projectFile} && mxbuild ` +
`-o /tmp/automation.mda /source/${projectFile}"`,
`--modern-web-client --ignore-unsupported-widgets -o /tmp/automation.mda /source/${projectFile}"`,
{ stdio: "inherit" }
);
console.log("Bundle created and all the widgets are updated");
Expand Down Expand Up @@ -158,7 +157,7 @@ async function copyGitHubTestProject() {
);
}
mkdir("-p", "tests/testProject");
await promisify(exec)(`unzip -o ${testArchivePath} -d tests/testProject`);
execSync(`unzip -o ${testArchivePath} -d tests/testProject`, { stdio: "inherit" });
if (process.argv.includes("--remove-atlas-files")) {
rm(
"-rf",
Expand Down
2 changes: 1 addition & 1 deletion packages/atlas/scripts/m2ee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ m2ee:
admin_pass: Password1!
runtime_port: 8080
runtime_listen_addresses: "*"
javaopts: ["-Dfile.encoding=UTF-8", "-XX:MaxPermSize=128M", "-Xmx512M", "-Xms512M", "-Djava.io.tmpdir=/source/tests/testProject/deployment/data/tmp"]
javaopts: ["-Dfile.encoding=UTF-8", "-Xmx512M", "-Xms512M", "-Djava.io.tmpdir=/source/tests/testProject/deployment/data/tmp"]
javabin: /usr/bin/java
pidfile: /var/run/m2ee.pid
mxruntime:
Expand Down
45 changes: 27 additions & 18 deletions packages/atlas/scripts/mxbuild.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
FROM mcr.microsoft.com/dotnet/runtime:6.0
FROM --platform=$BUILDPLATFORM eclipse-temurin:21-jdk-jammy
ARG MENDIX_VERSION
ARG BUILDPLATFORM

SHELL ["/bin/bash", "-c"]
RUN \
echo "Installing Java..." && \
apt-get -qq update && \
apt-get -qq install -y wget libgdiplus && \
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 && \
mkdir /usr/lib/jvm && \
tar xfz /tmp/openjdk.tar.gz --directory /usr/lib/jvm && \
rm /tmp/openjdk.tar.gz && \
echo "Downloading mxbuild ${MENDIX_VERSION} and docker building for ${BUILDPLATFORM}..." \
&& case "${BUILDPLATFORM}" in \
linux/arm64) \
BINARY_URL="https://cdn.mendix.com/runtime/arm64-mxbuild-${MENDIX_VERSION}.tar.gz"; \
;; \
linux/amd64) \
BINARY_URL="https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz"; \
;; \
*) \
echo "Unsupported architecture: ${BUILDPLATFORM}" >&2; \
exit 1; \
;; \
esac \
&& echo "Downloading from: ${BINARY_URL}" \
&& wget -q "${BINARY_URL}" -O /tmp/mxbuild.tar.gz \
&& mkdir /tmp/mxbuild \
&& tar xfz /tmp/mxbuild.tar.gz --directory /tmp/mxbuild \
&& rm /tmp/mxbuild.tar.gz && \
\
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 && \
\
apt-get -qq remove -y wget && \
apt-get update -qqy && \
apt-get install -qqy libicu70 libgdiplus && \
apt-get -qqy remove --auto-remove wget && \
apt-get clean && \
\
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 && \
echo "/tmp/mxbuild/modeler/mxbuild --java-home=/opt/java/openjdk --java-exe-path=/opt/java/openjdk/bin/java \$@" >>/bin/mxbuild && \
chmod +x /bin/mxbuild && \
\
echo "#!/bin/bash -x" >/bin/mx && \
echo "dotnet /tmp/mxbuild/modeler/mx.dll \$@" >>/bin/mx && \
chmod +x /bin/mx
echo "/tmp/mxbuild/modeler/mx \$@" >>/bin/mx && \
chmod +x /bin/mx
2 changes: 1 addition & 1 deletion packages/atlas/scripts/runtime.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM adoptopenjdk/openjdk11:jdk-11.0.19_7-slim
FROM eclipse-temurin:21-jdk-jammy

ARG MENDIX_VERSION

Expand Down
43 changes: 26 additions & 17 deletions scripts/mxbuild.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
FROM mono:6.12
FROM --platform=$BUILDPLATFORM eclipse-temurin:17-jdk-jammy
ARG MENDIX_VERSION
ARG BUILDPLATFORM

SHELL ["/bin/bash", "-c"]
RUN \
echo "Installing Java..." && \
apt-get -qq update && \
apt-get -qq install -y wget && \
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 && \
mkdir /usr/lib/jvm && \
tar xfz /tmp/openjdk.tar.gz --directory /usr/lib/jvm && \
rm /tmp/openjdk.tar.gz && \
echo "Downloading mxbuild ${MENDIX_VERSION} and docker building for ${BUILDPLATFORM}..." \
&& case "${BUILDPLATFORM}" in \
linux/arm64) \
BINARY_URL="https://cdn.mendix.com/runtime/arm64-mxbuild-${MENDIX_VERSION}.tar.gz"; \
;; \
linux/amd64) \
BINARY_URL="https://cdn.mendix.com/runtime/mxbuild-${MENDIX_VERSION}.tar.gz"; \
;; \
*) \
echo "Unsupported architecture: ${BUILDPLATFORM}" >&2; \
exit 1; \
;; \
esac \
&& echo "Downloading from: ${BINARY_URL}" \
&& wget -q "${BINARY_URL}" -O /tmp/mxbuild.tar.gz \
&& mkdir /tmp/mxbuild \
&& tar xfz /tmp/mxbuild.tar.gz --directory /tmp/mxbuild \
&& rm /tmp/mxbuild.tar.gz && \
\
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 && \
\
apt-get -qq remove -y wget && \
apt-get update -qqy && \
apt-get install -qqy libicu70 libgdiplus && \
apt-get -qqy remove --auto-remove wget && \
apt-get clean && \
\
echo "#!/bin/bash -x" >/bin/mxbuild && \
echo "mono /tmp/mxbuild/modeler/mxbuild.exe --java-home=/usr/lib/jvm/jdk-11.0.2 --java-exe-path=/usr/lib/jvm/jdk-11.0.2/bin/java \$@" >>/bin/mxbuild && \
echo "/tmp/mxbuild/modeler/mxbuild --java-home=/opt/java/openjdk --java-exe-path=/opt/java/openjdk/bin/java \$@" >>/bin/mxbuild && \
chmod +x /bin/mxbuild && \
\
echo "#!/bin/bash -x" >/bin/mx && \
echo "mono /tmp/mxbuild/modeler/mx.exe \$@" >>/bin/mx && \
echo "/tmp/mxbuild/modeler/mx \$@" >>/bin/mx && \
chmod +x /bin/mx
5 changes: 3 additions & 2 deletions scripts/release/gh-release-atlas-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = async function createAtlasCoreModule() {
`No unreleased changes found in the CHANGELOG.md for ${moduleInfo.nameWithSpace} ${moduleInfo.version}.`
);
}
await commitAndCreatePullRequest(moduleInfo);
const targetBranchName = await commitAndCreatePullRequest(moduleInfo);
await updateTestProject(moduleInfo, testProject, tmp);

const mpkOutput = await createMPK(testProject, moduleInfo, regex.excludeFiles);
Expand All @@ -57,7 +57,8 @@ module.exports = async function createAtlasCoreModule() {
title: `${moduleInfo.nameWithSpace} - Marketplace Release v${moduleInfo.version}`,
body: moduleChangelogs.replace(/"/g, "'"),
tag: `${moduleFolderNameInRepo}-v${moduleInfo.version}`,
mpkOutput,
target: targetBranchName,
filesToRelease: mpkOutput,
isDraft: true
});

Expand Down
15 changes: 11 additions & 4 deletions scripts/release/gh-release-atlas-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
githubAuthentication,
cloneRepo,
createMPK,
createGithubRelease,
createGithubReleaseFrom,
regex
} = require("./module-automation/commons");

Expand All @@ -29,12 +29,19 @@ module.exports = async function createAtlasNativeContentModule() {
};
await githubAuthentication(moduleInfo);
const moduleChangelogs = await updateModuleChangelogs(moduleInfo);
await commitAndCreatePullRequest(moduleInfo);
const targetBranchName = await commitAndCreatePullRequest(moduleInfo);
await updateNativeComponentsTestProjectWithAtlas(moduleInfo, tmpFolder);
const mpkOutput = await createMPK(tmpFolder, moduleInfo, regex.excludeFiles);
console.log(`Change owner and group after module export...`);
execSync(`sudo chown -R runner:docker ${tmpFolder}`, { stdio: "inherit" });
await createGithubRelease(moduleInfo, moduleChangelogs, mpkOutput);
console.log(`Creating Github release for module ${moduleInfo.nameWithSpace}`);
await createGithubReleaseFrom({
title: `${moduleInfo.nameWithSpace} ${moduleInfo.version} - Mendix ${moduleInfo.minimumMXVersion}`,
body: moduleChangelogs,
target: targetBranchName,
tag: process.env.TAG,
filesToRelease: mpkOutput
});
await execShellCommand(`rm -rf ${tmpFolder}`);
console.log("Done.");
};
Expand All @@ -49,7 +56,7 @@ async function updateNativeComponentsTestProjectWithAtlas(moduleInfo, tmpFolder)
const tmpFolderNativeStyles = join(tmpFolder, `themesource/${moduleInfo.moduleFolderNameInModeler}`);

console.log("Updating NativeComponentsTestProject..");
await cloneRepo(moduleInfo.testProjectUrl, testProject, moduleInfo.testProjectBranchName);
await cloneRepo(moduleInfo.testProjectUrl, tmpFolder, moduleInfo.testProjectBranchName);

console.log("Copying Native styling files..");
await Promise.all([
Expand Down
5 changes: 3 additions & 2 deletions scripts/release/gh-release-atlas-web-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = async function createAtlasWebContentModule() {
`No unreleased changes found in the CHANGELOG.md for ${moduleInfo.nameWithSpace} ${moduleInfo.version}.`
);
}
await commitAndCreatePullRequest(moduleInfo);
const targetBranchName = await commitAndCreatePullRequest(moduleInfo);
await updateTestProject(moduleInfo, testProject, tmp);
const mpkOutput = await createMPK(testProject, moduleInfo, regex.excludeFiles);
console.log(`Change owner and group after module export...`);
Expand All @@ -66,7 +66,8 @@ module.exports = async function createAtlasWebContentModule() {
title: `${moduleInfo.nameWithSpace} - Marketplace Release v${moduleInfo.version}`,
body: moduleChangelogs.replace(/"/g, "'"),
tag: `${moduleFolderNameInRepo}-v${moduleInfo.version}`,
mpkOutput,
target: targetBranchName,
filesToRelease: mpkOutput,
isDraft: true
});

Expand Down
46 changes: 26 additions & 20 deletions scripts/release/module-automation/commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async function getPackageInfo(path) {
url: repository?.url,
testProjectUrl: testProject?.githubUrl,
testProjectBranchName: testProject?.branchName,
testProjectMxVersion: testProject?.mxVersion,
changelogPath: `${path}/CHANGELOG.md`
};
} catch (error) {
Expand All @@ -80,12 +81,21 @@ async function createModuleMpkInDocker(sourceDir, moduleName, mendixVersion, exc

// Build testProject via mxbuild
const projectFile = basename((await getFiles(sourceDir, [`.mpr`]))[0]);
await execShellCommand(
`docker run -t -v ${sourceDir}:/source ` +
`--rm mxbuild:${mendixVersion} bash -c "mx update-widgets --loose-version-check /source/${projectFile} && mono /tmp/mxbuild/modeler/mxutil.exe create-module-package ${
excludeFilesRegExp ? `--exclude-files='${excludeFilesRegExp}'` : ""
} /source/${projectFile} ${moduleName}"`
);

const args = [
// update widgets
"mx",
"update-widgets",
"--loose-version-check",
`/source/${projectFile}`,
"&&",
"/tmp/mxbuild/modeler/mxutil create-module-package",
excludeFilesRegExp ? `--exclude-files='${excludeFilesRegExp}'` : "",
`/source/${projectFile}`,
moduleName
].join(" ");

await execShellCommand(`docker run -v ${sourceDir}:/source --rm mxbuild:${mendixVersion} bash -c "${args}"`);
console.log(`Module ${moduleName} created successfully.`);
}

Expand Down Expand Up @@ -169,6 +179,8 @@ async function commitAndCreatePullRequest(moduleInfo) {
`gh pr create --title "${moduleInfo.nameWithSpace}: Updating changelogs" --body "This is an automated PR." --base main --head ${changelogBranchName}`
);
console.log("Created PR for changelog updates.");

return changelogBranchName;
}

async function updateWidgetChangelogs(widgetsFolders) {
Expand Down Expand Up @@ -232,30 +244,24 @@ async function createMPK(tmpFolder, moduleInfo, excludeFilesRegExp) {
await createModuleMpkInDocker(
tmpFolder,
moduleInfo.moduleNameInModeler,
moduleInfo.minimumMXVersion,
moduleInfo.testProjectMxVersion,
excludeFilesRegExp
);
return (await getFiles(tmpFolder, [`.mpk`]))[0];
}

async function createGithubRelease(moduleInfo, moduleChangelogs, mpkOutput) {
console.log(`Creating Github release for module ${moduleInfo.nameWithSpace}`);
await createGithubReleaseFrom({
title: `${moduleInfo.nameWithSpace} ${moduleInfo.version} - Mendix ${moduleInfo.minimumMXVersion}`,
body: moduleChangelogs,
tag: process.env.TAG,
mpkOutput
});
}
async function createGithubReleaseFrom(params) {
const { body, title, tag, filesToRelease = "", target, isDraft = false, repo } = params;

async function createGithubReleaseFrom({ title, body, tag, mpkOutput, isDraft = false }) {
const command = [
`gh release create`,
`--title '${title}'`,
`--notes '${body}'`,
isDraft ? "--draft" : "",
repo ? `-R '${repo}'` : "",
`'${tag}'`,
`'${mpkOutput}'`
`--target '${target}'`,
filesToRelease ? `'${filesToRelease}'` : ""
]
.filter(str => str !== "")
.join(" ");
Expand All @@ -268,7 +274,8 @@ function zip(src, fileName) {
}

function unzip(src, dest) {
return execShellCommand(`unzip "${src}" -d "${dest}"`);
console.log(`unzip ${src} to ${dest}`);
return execShellCommand(`unzip -qq "${src}" -d "${dest}"`);
}

// Unzip the module, copy the widget and update package.xml
Expand Down Expand Up @@ -329,7 +336,6 @@ module.exports = {
updateChangelogs,
cloneRepo,
createMPK,
createGithubRelease,
createGithubReleaseFrom,
writeToWidgetChangelogs,
zip,
Expand Down
Loading