diff --git a/packages/atlas-core/package.json b/packages/atlas-core/package.json index e15a18b02..0414b5541 100644 --- a/packages/atlas-core/package.json +++ b/packages/atlas-core/package.json @@ -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", diff --git a/packages/atlas/package.json b/packages/atlas/package.json index 765b39a21..3676997f4 100644 --- a/packages/atlas/package.json +++ b/packages/atlas/package.json @@ -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", diff --git a/packages/atlas/scripts/e2e.playwright.js b/packages/atlas/scripts/e2e.playwright.js index fbc8780d9..ee68cf904 100644 --- a/packages/atlas/scripts/e2e.playwright.js +++ b/packages/atlas/scripts/e2e.playwright.js @@ -14,8 +14,6 @@ main().catch(e => { }); async function main() { - const mendixVersion = await getMendixVersion(); - try { execSync("docker info"); } catch (e) { @@ -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) { @@ -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"); @@ -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", diff --git a/packages/atlas/scripts/m2ee.yml b/packages/atlas/scripts/m2ee.yml index 81006db63..3f7d563d1 100644 --- a/packages/atlas/scripts/m2ee.yml +++ b/packages/atlas/scripts/m2ee.yml @@ -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: diff --git a/packages/atlas/scripts/mxbuild.Dockerfile b/packages/atlas/scripts/mxbuild.Dockerfile index bb1d2cb6d..e45ea9799 100644 --- a/packages/atlas/scripts/mxbuild.Dockerfile +++ b/packages/atlas/scripts/mxbuild.Dockerfile @@ -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 \ No newline at end of file diff --git a/packages/atlas/scripts/runtime.Dockerfile b/packages/atlas/scripts/runtime.Dockerfile index 72e0d2a73..7831472b1 100644 --- a/packages/atlas/scripts/runtime.Dockerfile +++ b/packages/atlas/scripts/runtime.Dockerfile @@ -1,4 +1,4 @@ -FROM adoptopenjdk/openjdk11:jdk-11.0.19_7-slim +FROM eclipse-temurin:21-jdk-jammy ARG MENDIX_VERSION diff --git a/scripts/mxbuild.Dockerfile b/scripts/mxbuild.Dockerfile index 7885937eb..65aaa5b5f 100644 --- a/scripts/mxbuild.Dockerfile +++ b/scripts/mxbuild.Dockerfile @@ -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 diff --git a/scripts/release/gh-release-atlas-core.js b/scripts/release/gh-release-atlas-core.js index d52493814..41f8d4edc 100644 --- a/scripts/release/gh-release-atlas-core.js +++ b/scripts/release/gh-release-atlas-core.js @@ -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); @@ -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 }); diff --git a/scripts/release/gh-release-atlas-native.js b/scripts/release/gh-release-atlas-native.js index a2cf1d2e9..d4a4afbbe 100644 --- a/scripts/release/gh-release-atlas-native.js +++ b/scripts/release/gh-release-atlas-native.js @@ -10,7 +10,7 @@ const { githubAuthentication, cloneRepo, createMPK, - createGithubRelease, + createGithubReleaseFrom, regex } = require("./module-automation/commons"); @@ -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."); }; @@ -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([ diff --git a/scripts/release/gh-release-atlas-web-content.js b/scripts/release/gh-release-atlas-web-content.js index e8b172c48..98fe3e1bb 100644 --- a/scripts/release/gh-release-atlas-web-content.js +++ b/scripts/release/gh-release-atlas-web-content.js @@ -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...`); @@ -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 }); diff --git a/scripts/release/module-automation/commons.js b/scripts/release/module-automation/commons.js index ac80e9fb6..7865547e2 100644 --- a/scripts/release/module-automation/commons.js +++ b/scripts/release/module-automation/commons.js @@ -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) { @@ -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.`); } @@ -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) { @@ -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(" "); @@ -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 @@ -329,7 +336,6 @@ module.exports = { updateChangelogs, cloneRepo, createMPK, - createGithubRelease, createGithubReleaseFrom, writeToWidgetChangelogs, zip,