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
45 changes: 45 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -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
75 changes: 36 additions & 39 deletions .github/workflows/npm-build.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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: Test All
working-directory: ./imxweb
run: npm run nx:test-ci
timeout-minutes: 40
timeout-minutes: 30

- 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


7 changes: 3 additions & 4 deletions imxweb/scripts/install-local-packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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('');
Expand Down
3 changes: 1 addition & 2 deletions imxweb/scripts/install-local-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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('');
Expand Down