mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-02 17:53:30 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.2 to 7.0.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
82 lines
2.8 KiB
YAML
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- 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 }}
|