From f10f1611460baf85b4b1716b2962b4111f5c7983 Mon Sep 17 00:00:00 2001 From: "PROD\\CGriffit" Date: Fri, 20 Feb 2026 12:40:48 +0100 Subject: [PATCH 1/2] Move to linux --- .github/actions/setup/action.yml | 45 ++++++++++++++ .github/workflows/npm-build.yml | 79 ++++++++++++------------ imxweb/scripts/install-local-packages.js | 7 +-- imxweb/scripts/install-local-packages.ts | 3 +- 4 files changed, 87 insertions(+), 47 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 000000000..8b1458fca --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,45 @@ +name: 'Setup Environment' +description: 'Common setup steps for Node and dependencies' + +outputs: + node-version: + description: 'Selected Node version' + value: ${{ steps.which_node.outputs.version }} + +runs: + using: 'composite' + steps: + - name: Select Node Version + id: which_node + shell: pwsh + run: | + # Determine branch (handles push vs PR) + $branch = "${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}" + + # Select node version based on branch + switch ($branch) { + "v93" { $node = "20.x" } + "v100" { $node = "22.x" } + # Future changes: + # "v102" { $node = "24.x" } + default { $node = "22.x" } + } + + # Output clear info for logs + Write-Host "🔹 Branch detected: $branch" + Write-Host "🔹 Node version selected: $node" + + # Pass to subsequent steps + echo "version=$node" >> $env:GITHUB_OUTPUT + + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version: ${{ steps.which_node.outputs.version }} + cache: npm + cache-dependency-path: ./imxweb/package-lock.json + + - name: Install packages + shell: bash + working-directory: ./imxweb + run: npm install --skip-dialog \ No newline at end of file diff --git a/.github/workflows/npm-build.yml b/.github/workflows/npm-build.yml index 4fbc7571d..b7fdad219 100644 --- a/.github/workflows/npm-build.yml +++ b/.github/workflows/npm-build.yml @@ -1,4 +1,5 @@ -name: Build Angular workspace +name: One Identity Frontend CI Build +description: CI workflow to build, package and test One Identity frontend applications on: push: @@ -7,50 +8,46 @@ on: branches: [ v100, v93 ] jobs: - build: - runs-on: windows-latest - + ci: + name: Build, package, and test applications + runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - - name: Select Node version - id: node - shell: pwsh - run: | - # Determine branch (handles push vs PR) - $branch = "${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}" - - # Select node version based on branch - switch ($branch) { - "v93" { $node = "20.x" } - "v100" { $node = "22.x" } - # Future changes: - # "v110" { $node = "24.x" } - default { $node = "22.x" } - } - - # Output clear info for logs - Write-Host "🔹 Branch detected: $branch" - Write-Host "🔹 Node version selected: $node" - - # Pass to subsequent steps - echo "version=$node" >> $env:GITHUB_OUTPUT - - - name: Setup Node - uses: actions/setup-node@v6 - with: - node-version: ${{ steps.node.outputs.version }} - - name: Install packages - working-directory: ./imxweb - run: npm install --skip-dialog + - uses: ./.github/actions/setup # Setup steps + # Need to use nx cloud/ nx replay instead + # - name: Cache Nx + # uses: actions/cache@v5 + # with: + # path: ./imxweb/.nx/cache + # key: nx-${{ runner.os }}-${{ hashFiles('imxweb/package-lock.json') }} + # restore-keys: | + # nx-${{ runner.os }}- + - name: Build All working-directory: ./imxweb - run: npm run nx:build-all - timeout-minutes: 25 + run: npx nx run-many -t build -c production + + - name: Zip applications + run: | + # Dynamically get app names from projects dir + apps=$(ls -d ./imxweb/projects/*-app* 2>/dev/null | xargs -n1 basename) + for app in $apps; do + if [ -d "./imxweb/dist/$app" ]; then + ( cd "./imxweb/dist/$app" && zip -r "../Html_${app}.zip" . ) + fi + done + + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + name: imxweb-apps + path: ./imxweb/dist/Html_*.zip - - name: Test All - working-directory: ./imxweb - run: npm run nx:test-ci - timeout-minutes: 40 + # Tests currently do not work + # - name: Test All + # working-directory: ./imxweb + # run: npm run nx:test-ci + # timeout-minutes: 30 + \ No newline at end of file diff --git a/imxweb/scripts/install-local-packages.js b/imxweb/scripts/install-local-packages.js index 564bcb909..1ee4f1785 100644 --- a/imxweb/scripts/install-local-packages.js +++ b/imxweb/scripts/install-local-packages.js @@ -34,8 +34,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); @@ -74,7 +74,6 @@ var process = require("process"); var readline = require("readline"); // Look for a positional argument to point where the imx-modules are; defaults to imx-modules var imxModuleDir = process.argv.length > 2 ? process.argv[2] : 'imx-modules'; -var isWin = process.platform === 'win32'; var nodePackageDir = '@imx-modules'; var nodeElementalDir = '@elemental-ui'; var nodeModuleDir = 'node_modules'; @@ -139,7 +138,7 @@ function overwrite() { fs.readdirSync(imxModuleDir) .filter(function (file) { return file.endsWith('.tgz'); }) .forEach(function (file) { - filePath = isWin ? path.join(imxModuleDir, file) : path.join(__dirname, imxModuleDir, file); + filePath = path.resolve(imxModuleDir, file); if (file.includes('imx-')) { var baseName = path.parse(file).name; installArg += [nodePackageDir, '/', baseName, '@', filePath, ' '].join(''); diff --git a/imxweb/scripts/install-local-packages.ts b/imxweb/scripts/install-local-packages.ts index 98798456f..7e49ce166 100644 --- a/imxweb/scripts/install-local-packages.ts +++ b/imxweb/scripts/install-local-packages.ts @@ -41,7 +41,6 @@ import * as readline from 'readline'; // Look for a positional argument to point where the imx-modules are; defaults to imx-modules const imxModuleDir = process.argv.length > 2 ? process.argv[2] : 'imx-modules'; -const isWin = process.platform === 'win32'; const nodePackageDir = '@imx-modules'; const nodeElementalDir = '@elemental-ui'; const nodeModuleDir = 'node_modules'; @@ -97,7 +96,7 @@ function overwrite() { fs.readdirSync(imxModuleDir) .filter((file) => file.endsWith('.tgz')) .forEach((file) => { - filePath = isWin ? path.join(imxModuleDir, file) : path.join(__dirname, imxModuleDir, file); + filePath = path.resolve(imxModuleDir, file); if (file.includes('imx-')) { const baseName = path.parse(file).name; installArg += [nodePackageDir, '/', baseName, '@', filePath, ' '].join(''); From ffd3a987049b65556437b8bf4bb4d47728698484 Mon Sep 17 00:00:00 2001 From: "PROD\\CGriffit" Date: Fri, 20 Feb 2026 13:06:32 +0100 Subject: [PATCH 2/2] re-enable tests --- .github/workflows/npm-build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/npm-build.yml b/.github/workflows/npm-build.yml index b7fdad219..d15a4bb0e 100644 --- a/.github/workflows/npm-build.yml +++ b/.github/workflows/npm-build.yml @@ -28,7 +28,12 @@ jobs: - name: Build All working-directory: ./imxweb run: npx nx run-many -t build -c production - + + - name: Test All + working-directory: ./imxweb + run: npm run nx:test-ci + timeout-minutes: 30 + - name: Zip applications run: | # Dynamically get app names from projects dir @@ -45,9 +50,4 @@ jobs: name: imxweb-apps path: ./imxweb/dist/Html_*.zip - # Tests currently do not work - # - name: Test All - # working-directory: ./imxweb - # run: npm run nx:test-ci - # timeout-minutes: 30 \ No newline at end of file