Skip to content

CI

CI #3217

Workflow file for this run

name: CI
on:
# NOTE: If you change these you must update ci-noop.yml as well
pull_request:
paths-ignore:
- 'microsite/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# This step only runs yarn install to make sure that an exact match is available
# in the cache. The two following verify and tests jobs then always install from cache.
install:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [16.x, 18.x]
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
name: Install ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install
uses: backstage/actions/[email protected]
with:
cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }}
# The verify jobs runs all the verification that doesn't require a
# diff towards master, since it takes some time to fetch that.
verify:
runs-on: ubuntu-latest
needs: install
strategy:
fail-fast: false
matrix:
node-version: [16.x, 18.x]
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
name: Verify ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install
uses: backstage/actions/[email protected]
with:
cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }}
- name: verify yarn dependency duplicates
run: node scripts/verify-lockfile-duplicates.js
- name: verify changesets
run: node scripts/verify-changesets.js
- name: verify local dependency ranges
run: node scripts/verify-local-dependencies.js
- name: validate config
run: yarn backstage-cli config:check --lax
- name: type checking and declarations
run: yarn tsc:full
- name: prettier
run: yarn prettier:check
# We need to generate the API references as well, so that we can verify the doc links
- name: check api reports and generate API reference
run: yarn build:api-reports:only --ci --docs
- name: verify api reference
run: node scripts/verify-api-reference.js
- name: lint openapi yaml files
run: yarn backstage-repo-tools schema openapi lint
- name: verify openapi yaml file matches generated ts file
run: yarn backstage-repo-tools schema openapi verify
- name: verify doc links
run: node scripts/verify-links.js
- name: build all packages
run: yarn backstage-cli repo build --all
- name: verify type dependencies
run: yarn lint:type-deps
- 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
# The test job runs all tests as well as any verification step that
# requires a diff towards master.
test:
runs-on: ubuntu-latest
needs: install
strategy:
fail-fast: false
matrix:
node-version: [16.x, 18.x]
name: Test ${{ matrix.node-version }}
services:
postgres13:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432/tcp
postgres9:
image: postgres:9
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432/tcp
mysql8:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306/tcp
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
INTEGRATION_TEST_GITHUB_TOKEN: ${{ secrets.INTEGRATION_TEST_GITHUB_TOKEN }}
INTEGRATION_TEST_GITLAB_TOKEN: ${{ secrets.INTEGRATION_TEST_GITLAB_TOKEN }}
INTEGRATION_TEST_BITBUCKET_TOKEN: ${{ secrets.INTEGRATION_TEST_BITBUCKET_TOKEN }}
INTEGRATION_TEST_AZURE_TOKEN: ${{ secrets.INTEGRATION_TEST_AZURE_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: fetch branch master
run: git fetch origin master
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install
uses: backstage/actions/[email protected]
with:
cache-prefix: ${{ runner.os }}-v${{ matrix.node-version }}
- name: lint changed packages
run: yarn backstage-cli repo lint --since origin/master
- name: test changed packages
run: yarn backstage-cli repo test --maxWorkers=2 --workerIdleMemoryLimit=1300M --since origin/master
env:
BACKSTAGE_TEST_DISABLE_DOCKER: 1
BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres13.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres9.ports[5432] }}
BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING: mysql://root:root@localhost:${{ job.services.mysql8.ports[3306] }}/ignored
- 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