Skip to content

d2e-ui/portal components tests #13731

d2e-ui/portal components tests

d2e-ui/portal components tests #13731

name: d2e-ui/portal components tests
permissions:
contents: read
on:
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
merge_group:
push:
branches:
- develop
jobs:
pick_runner:
runs-on: ubuntu-latest
outputs:
random_runner: ${{ steps.shuffle.outputs.random_runner }}
steps:
- id: shuffle
run: echo "random_runner=$(shuf -e ubuntu-22.04 ubuntu-24.04 | head -n 1)" >> "$GITHUB_OUTPUT"
test-alp-portal-components:
needs: [pick_runner]
runs-on: ${{ needs.pick_runner.outputs.random_runner }}
defaults:
run:
working-directory: ./plugins/ui
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dorny/paths-filter@v3
id: check_file_changed
with:
filters: |
portal_components_changed:
- 'libs/portal-components/**'
- '.github/workflows/ui-alp-portal-test-components.yml'
- name: Setup bun if files have changed
uses: oven-sh/setup-bun@v2
if: github.ref_name == 'develop' || github.event_name == 'merge_group' || steps.check_file_changed.outputs.portal_components_changed == 'true'
with:
bun-version: 1.2.23
# Run the step only with "portal_components_changed" equals "True"
- name: Run unit tests if files have changed
if: github.ref_name == 'develop' || github.event_name == 'merge_group' || steps.check_file_changed.outputs.portal_components_changed == 'true'
run: |
bun install
cd libs/portal-components
bun svgr
bun run test