Skip to content

Commit 56940c9

Browse files
authored
Merge pull request #458 from OneIdentity/change/use-linux-builds
Move to linux
2 parents 23ddd34 + 93f72ba commit 56940c9

4 files changed

Lines changed: 85 additions & 45 deletions

File tree

.github/actions/setup/action.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Setup Environment'
2+
description: 'Common setup steps for Node and dependencies'
3+
4+
outputs:
5+
node-version:
6+
description: 'Selected Node version'
7+
value: ${{ steps.which_node.outputs.version }}
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Select Node Version
13+
id: which_node
14+
shell: pwsh
15+
run: |
16+
# Determine branch (handles push vs PR)
17+
$branch = "${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}"
18+
19+
# Select node version based on branch
20+
switch ($branch) {
21+
"v93" { $node = "20.x" }
22+
"v100" { $node = "22.x" }
23+
# Future changes:
24+
# "v102" { $node = "24.x" }
25+
default { $node = "22.x" }
26+
}
27+
28+
# Output clear info for logs
29+
Write-Host "🔹 Branch detected: $branch"
30+
Write-Host "🔹 Node version selected: $node"
31+
32+
# Pass to subsequent steps
33+
echo "version=$node" >> $env:GITHUB_OUTPUT
34+
35+
- name: Setup Node
36+
uses: actions/setup-node@v6
37+
with:
38+
node-version: ${{ steps.which_node.outputs.version }}
39+
cache: npm
40+
cache-dependency-path: ./imxweb/package-lock.json
41+
42+
- name: Install packages
43+
shell: bash
44+
working-directory: ./imxweb
45+
run: npm install --skip-dialog

.github/workflows/npm-build.yml

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Build Angular workspace
1+
name: One Identity Frontend CI Build
2+
description: CI workflow to build, package and test One Identity frontend applications
23

34
on:
45
push:
@@ -7,50 +8,46 @@ on:
78
branches: [ v100, v93 ]
89

910
jobs:
10-
build:
11-
runs-on: windows-latest
12-
11+
ci:
12+
name: Build, package, and test applications
13+
runs-on: ubuntu-latest
1314
steps:
1415
- uses: actions/checkout@v6
15-
16-
- name: Select Node version
17-
id: node
18-
shell: pwsh
19-
run: |
20-
# Determine branch (handles push vs PR)
21-
$branch = "${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}"
22-
23-
# Select node version based on branch
24-
switch ($branch) {
25-
"v93" { $node = "20.x" }
26-
"v100" { $node = "22.x" }
27-
# Future changes:
28-
# "v110" { $node = "24.x" }
29-
default { $node = "22.x" }
30-
}
31-
32-
# Output clear info for logs
33-
Write-Host "🔹 Branch detected: $branch"
34-
Write-Host "🔹 Node version selected: $node"
35-
36-
# Pass to subsequent steps
37-
echo "version=$node" >> $env:GITHUB_OUTPUT
38-
39-
- name: Setup Node
40-
uses: actions/setup-node@v6
41-
with:
42-
node-version: ${{ steps.node.outputs.version }}
4316

44-
- name: Install packages
45-
working-directory: ./imxweb
46-
run: npm install --skip-dialog
17+
- uses: ./.github/actions/setup # Setup steps
4718

19+
# Need to use nx cloud/ nx replay instead
20+
# - name: Cache Nx
21+
# uses: actions/cache@v5
22+
# with:
23+
# path: ./imxweb/.nx/cache
24+
# key: nx-${{ runner.os }}-${{ hashFiles('imxweb/package-lock.json') }}
25+
# restore-keys: |
26+
# nx-${{ runner.os }}-
27+
4828
- name: Build All
4929
working-directory: ./imxweb
50-
run: npm run nx:build-all
51-
timeout-minutes: 25
52-
30+
run: npx nx run-many -t build -c production
31+
5332
- name: Test All
5433
working-directory: ./imxweb
5534
run: npm run nx:test-ci
56-
timeout-minutes: 40
35+
timeout-minutes: 30
36+
37+
- name: Zip applications
38+
run: |
39+
# Dynamically get app names from projects dir
40+
apps=$(ls -d ./imxweb/projects/*-app* 2>/dev/null | xargs -n1 basename)
41+
for app in $apps; do
42+
if [ -d "./imxweb/dist/$app" ]; then
43+
( cd "./imxweb/dist/$app" && zip -r "../Html_${app}.zip" . )
44+
fi
45+
done
46+
47+
- name: Upload artifacts
48+
uses: actions/upload-artifact@v6
49+
with:
50+
name: imxweb-apps
51+
path: ./imxweb/dist/Html_*.zip
52+
53+

imxweb/scripts/install-local-packages.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3434
});
3535
};
3636
var __generator = (this && this.__generator) || function (thisArg, body) {
37-
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);
38-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
38+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
3939
function verb(n) { return function (v) { return step([n, v]); }; }
4040
function step(op) {
4141
if (f) throw new TypeError("Generator is already executing.");
@@ -74,7 +74,6 @@ var process = require("process");
7474
var readline = require("readline");
7575
// Look for a positional argument to point where the imx-modules are; defaults to imx-modules
7676
var imxModuleDir = process.argv.length > 2 ? process.argv[2] : 'imx-modules';
77-
var isWin = process.platform === 'win32';
7877
var nodePackageDir = '@imx-modules';
7978
var nodeElementalDir = '@elemental-ui';
8079
var nodeModuleDir = 'node_modules';
@@ -139,7 +138,7 @@ function overwrite() {
139138
fs.readdirSync(imxModuleDir)
140139
.filter(function (file) { return file.endsWith('.tgz'); })
141140
.forEach(function (file) {
142-
filePath = isWin ? path.join(imxModuleDir, file) : path.join(__dirname, imxModuleDir, file);
141+
filePath = path.resolve(imxModuleDir, file);
143142
if (file.includes('imx-')) {
144143
var baseName = path.parse(file).name;
145144
installArg += [nodePackageDir, '/', baseName, '@', filePath, ' '].join('');

imxweb/scripts/install-local-packages.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import * as readline from 'readline';
4141
// Look for a positional argument to point where the imx-modules are; defaults to imx-modules
4242
const imxModuleDir = process.argv.length > 2 ? process.argv[2] : 'imx-modules';
4343

44-
const isWin = process.platform === 'win32';
4544
const nodePackageDir = '@imx-modules';
4645
const nodeElementalDir = '@elemental-ui';
4746
const nodeModuleDir = 'node_modules';
@@ -97,7 +96,7 @@ function overwrite() {
9796
fs.readdirSync(imxModuleDir)
9897
.filter((file) => file.endsWith('.tgz'))
9998
.forEach((file) => {
100-
filePath = isWin ? path.join(imxModuleDir, file) : path.join(__dirname, imxModuleDir, file);
99+
filePath = path.resolve(imxModuleDir, file);
101100
if (file.includes('imx-')) {
102101
const baseName = path.parse(file).name;
103102
installArg += [nodePackageDir, '/', baseName, '@', filePath, ' '].join('');

0 commit comments

Comments
 (0)