Files
alfresco-ng2-components/.github/workflows/unit-test-workflow.yml
T
Workflow config file is invalid. Please check your config file: getMatrixes: matrix include must be a list of mappings
Vito Albano 78661f11c5 [AAE-46514] - Migration to PNPM (#11926)
* [AAE-46514] - using by default ignore-scripts and have a trusted list for those who are trusted

* [AAE-46514] - Improved the checks to cover more cases

* [AAE-46514] - Fixed copilot comments

* [AAE-46514] - OTher fixes

* [AAE-46514] - Fixing other improvements and comments

* [AAE-46514] - npmrc should be versioned to enforce the audit

* [AAE-46514] - Improved code

* [AAE-46514] - Removed the check on CI as we have other tools

* [AAE-46514] - Improved check, updated descriptions, skip check on CI as there is already Sonar

* [AAE-46514] - Reduced functions in smaller pieces

* [AAE-46514] - Migrating to Pnpm to increase safety

* [ci:force] - Checking

* [ci:force] - Fixed complexity of the scripts

* [ci:force] - Fixed complexity of the scripts

* [ci:force] - Fixed wrong typing on yml

* [ci:force] - Fixed sonar comments and added correct version to sha pinned action

* [ci:force] - Fixed cache hit for npmn

* [ci:force] - Improved eslint plugin so it can be built with standard action

* [ci:force] - Improved eslint plugin so it can be built with standard action

* [ci:force] - Added minimatch

* [ci:force] - Fixing issues

* [ci:force] - Removed 'run' as it is not needed

* [ci:force] - Using audit in place of custom scripts

* [ci:force] - Fixed vulnerabilities and removed custom scripts in favor of audit --critical

* [ci:force] - Added minimum time for publishing to install

* [ci:force] - Address issue with too new packages

* [ci:force] - Address issue with too new packages
2026-06-04 18:38:22 +01:00

82 lines
2.8 KiB
YAML

name: "Unit Tests Workflow"
on:
workflow_call:
inputs:
base_ref:
description: 'Base branch for affected calculation'
required: false
type: string
default: 'develop'
jobs:
generate-affected-matrix:
name: "Generate affected matrix"
runs-on: ubuntu-latest
outputs:
unitMatrix: ${{ steps.set-matrix.outputs.unitMatrix }}
hasProjects: ${{ steps.set-matrix.outputs.hasProjects }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Setup environment
id: setup-env
uses: ./.github/actions/setup
with:
cache-suffix: test-matrix
- name: Generate affected projects matrix
id: set-matrix
env:
BASE_REF: ${{ inputs.base_ref }}
run: |
echo "Base ref is $BASE_REF"
AFFECTED_UNIT=$(pnpm nx show projects --affected --target=test --base=origin/$BASE_REF --head=HEAD --select=projects --plain --exclude=cli,stories,eslint-angular)
echo "Affected projects for UNIT: $AFFECTED_UNIT"
if [ -z "$AFFECTED_UNIT" ]; then
echo "No affected projects found"
echo "hasProjects=false" >> $GITHUB_OUTPUT
echo "unitMatrix=[]" >> $GITHUB_OUTPUT
else
UNIT_MATRIX_JSON=$(echo "$AFFECTED_UNIT" | xargs -n1 | jq -R -s -c 'split("\n") | map(select(length > 0)) | map({ "project": . })')
echo "Matrix UNIT: $UNIT_MATRIX_JSON"
echo "hasProjects=true" >> $GITHUB_OUTPUT
echo "unitMatrix=$UNIT_MATRIX_JSON" >> $GITHUB_OUTPUT
fi
- name: Save nx cache
if: ${{ success() }}
uses: ./.github/actions/save-nx-cache
with:
cache-suffix: test-matrix
unit-tests:
timeout-minutes: 30
runs-on: ubuntu-latest
needs: generate-affected-matrix
if: ${{ needs.generate-affected-matrix.outputs.hasProjects == 'true' }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-affected-matrix.outputs.unitMatrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup environment
id: setup-env
uses: ./.github/actions/setup
with:
cache-suffix: test-${{ matrix.project }}
full-setup: 'false'
- name: Run unit tests for ${{ matrix.project }}
env:
NODE_OPTIONS: "--max-old-space-size=5120"
run: |
xvfb-run --auto-servernum pnpm nx run ${{ matrix.project }}:test
- name: Save nx cache
if: ${{ success() }}
uses: ./.github/actions/save-nx-cache
with:
cache-suffix: test-${{ matrix.project }}