Skip to content

Add backstage config to package.json #405

Add backstage config to package.json

Add backstage config to package.json #405

Workflow file for this run

name: CI
on:
pull_request:
paths:
- "workspaces/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
find-changed-workspaces:
name: Detect workspace changes
runs-on: ubuntu-latest
outputs:
workspaces: ${{ steps.find-changed-workspaces.outputs.workspaces }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: Fetch previous commit for check
run: git fetch origin '${{ github.event.pull_request.base.sha }}'
- name: Find changed workspaces
id: find-changed-workspaces
run: node ./scripts/ci/list-workspaces-with-changes.js
env:
COMMIT_SHA_BEFORE: "${{ github.event.pull_request.base.sha }}"
ci:
name: Workspace ${{ matrix.workspace }}, CI step for node ${{ matrix.node-version }}
runs-on: ubuntu-latest
needs: find-changed-workspaces
if: ${{ needs.find-changed-workspaces.outputs.workspaces != '[]' }}
strategy:
matrix:
workspace: ${{ fromJSON(needs.find-changed-workspaces.outputs.workspaces) }}
node-version: [18.x, 20.x]
fail-fast: false
defaults:
run:
working-directory: ./workspaces/${{ matrix.workspace }}
env:
CI: true
NODE_OPTIONS: --max-old-space-size=8192
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Checkout main branch for tests purposes
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: main
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install
run: yarn install --immutable
- name: check for missing repo fixes
run: yarn fix --check
- name: validate config
if: ${{ hashFiles('app-config.yaml') != '' }}
run: yarn backstage-cli config:check --lax
- name: type checking and declarations
run: yarn tsc:full
- name: prettier
run: yarn prettier:check
- name: check api reports and generate API reference
run: yarn build:api-reports:only --ci
- name: build all packages
run: yarn backstage-cli repo build --all
- name: lint
run: yarn backstage-cli repo lint --since origin/main
- name: test changed packages
run: yarn backstage-cli repo test --coverage --maxWorkers=3
- name: ensure clean working directory
run: |
if files=$(git ls-files --exclude-standard --others --modified) && [[ -z "$files" ]]; then
exit 0
else
echo ""
echo "Working directory has been modified:"
echo ""
git status --short
echo ""
exit 1
fi
verify:
name: Workspace ${{ matrix.workspace }}, Verify step
runs-on: ubuntu-latest
needs: find-changed-workspaces
strategy:
matrix:
workspace: ${{ fromJSON(needs.find-changed-workspaces.outputs.workspaces) }}
fail-fast: false
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Checkout head branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Setup node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: 20.x
- name: Install root dependencies
run: yarn install --immutable
- name: Verify lockfile duplicates
run: node scripts/ci/verify-lockfile-duplicates.js workspaces/${{ matrix.workspace }}/yarn.lock
- name: Verify changesets
run: node scripts/ci/verify-changesets.js ${{ matrix.workspace }}
result:
if: ${{ always() }}
name: check all required jobs
runs-on: ubuntu-latest
needs: [ci, verify]
steps:
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
}}
dependency-review:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: "Checkout Repository"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Dependency Review"
uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0