Skip to content
Draft
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
85 changes: 65 additions & 20 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@ env:
MAPTILER_URL: https://api.maptiler.com/maps/voyager/style.json?key=${{ secrets.MAPTILER_KEY }}

jobs:
build:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # We need this for commit-lint
fetch-depth: 0 # We need this for lint:commit
- uses: actions/setup-node@v6
with:
node-version: lts/krypton
cache: 'npm'
- run: npm ci --prefer-offline --no-audit
- run: npm run lint:commit
- run: npm run lint:format
- run: npm run lint:scss
- run: npm run lint:ng
- run: npm run lint:playwright:eslint

build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: lts/krypton
Expand All @@ -35,7 +50,6 @@ jobs:
env:
SIEMENS_NPM_TOKEN: ${{ secrets.SIEMENS_NPM_TOKEN }}
- run: npm ci --prefer-offline --no-audit --include=optional
- run: npm run lint:commit
- run: npm run build:all
- run: npm run prepare-brand
- run: npm run build:all:update-translatable-keys # Output is needed in dist for providing default translations
Expand All @@ -49,7 +63,8 @@ jobs:
name: dist
path: dist

test:
test-suite:
name: test-suite (${{ matrix.name }})
runs-on: ubuntu-24.04
# We use playwright browser to run karma tests
container: mcr.microsoft.com/playwright:v1.57.0-noble
Expand All @@ -58,6 +73,28 @@ jobs:
HOME: /root
needs:
- build
strategy:
fail-fast: false
matrix:
include:
- name: translate
command: npm run translate:test -- --watch=false --progress=false --code-coverage
has-coverage: true
- name: element
command: npm run lib:test -- --watch=false --progress=false --code-coverage
has-coverage: true
- name: schematics
command: npm run schematics:test
has-coverage: false
- name: charts
command: npm run charts:test -- --watch=false --progress=false
has-coverage: false
- name: dashboards
command: npm run dashboards:test -- --watch=false --progress=false
has-coverage: false
- name: maps
command: npm run maps:test -- --watch=false --progress=false
has-coverage: false
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
Expand All @@ -69,37 +106,42 @@ jobs:
name: dist
path: dist
- run: npm ci --prefer-offline --no-audit
- run: npm run lint:format
- run: npm run lint:scss
- run: npm run lint:ng
- run: npm run lint:playwright:eslint
- run: npm run translate:test -- --watch=false --progress=false --code-coverage
- run: npm run lib:test -- --watch=false --progress=false --code-coverage
- run: npm run schematics:test
- run: npm run charts:test -- --watch=false --progress=false
- run: npm run dashboards:test -- --watch=false --progress=false
- run: npm run maps:test -- --watch=false --progress=false
- run: ${{ matrix.command }}
- uses: actions/upload-artifact@v6
if: ${{ matrix.has-coverage }}
with:
name: coverage-reports
name: coverage-report-${{ matrix.name }}
path: dist/coverage
retention-days: 30

test:
if: ${{ !cancelled() }}
runs-on: ubuntu-24.04
needs:
- test-suite
steps:
- run: |
if [[ "${{ needs.test-suite.result }}" == "failure" || "${{ needs.test-suite.result }}" == "cancelled" ]]; then
echo "Test suite failed or was cancelled"
exit 1
fi

coverage:
if: ${{ !cancelled() }}
runs-on: ubuntu-24.04
permissions:
pull-requests: write
contents: read
needs:
- test
- test-suite
steps:
- uses: actions/checkout@v6
- name: Download coverage reports
uses: actions/download-artifact@v7
with:
name: coverage-reports
pattern: coverage-report-*
path: dist/coverage
merge-multiple: true
- name: Generate coverage summary
uses: irongut/CodeCoverageSummary@v1.3.0
with:
Expand Down Expand Up @@ -223,7 +265,7 @@ jobs:
needs:
- build
- coverage
- test
- test-suite
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
Expand All @@ -237,8 +279,9 @@ jobs:
path: .
- uses: actions/download-artifact@v7
with:
name: coverage-reports
pattern: coverage-report-*
path: dist/coverage
merge-multiple: true
- uses: actions/setup-node@v6
with:
node-version: lts/krypton
Expand Down Expand Up @@ -282,6 +325,7 @@ jobs:
env:
BUCKET_NAME: simpl-element-preview
needs:
- lint
- e2e-merge-reports
- documentation
- coverage
Expand All @@ -296,8 +340,9 @@ jobs:
path: playwright-report
- uses: actions/download-artifact@v7
with:
name: coverage-reports
pattern: coverage-report-*
path: coverage-reports
merge-multiple: true
- uses: aws-actions/configure-aws-credentials@v6.0.0
with:
role-to-assume: arn:aws:iam::974483672234:role/simpl-element-preview
Expand Down
Loading