Skip to content

Commit becc773

Browse files
authored
Check in API data instead of building it every time (#591)
Previously, we checked out, built, and analyzed the Lit every time we deployed. Now, we check the generated data files into the Git repo instead. There is also a new GitHub check that ensures the checked in files are up-to-date. The advantages of this are: - We can see in PRs when the data files have changed. This lets us see the effects of changes from the annotations in the Lit source, changes to the API generator, or other changes/bugs. - Deploying should be much faster, since we no longer need to check out, build, and analyze the Lit repo as part of deploying. This will help even more once we are also analyzing the Lit 1.x repos.
1 parent 2525e49 commit becc773

File tree

5 files changed

+38426
-8
lines changed

5 files changed

+38426
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This action fails if the API docs JSON data files have changed but have not
2+
# been committed.
3+
4+
# We check generated API data into the Git repo because otherwise it is very
5+
# difficult to tell when something has changed or broken in them. It also makes
6+
# deploying faster, since we don't need to clone and analyze repos every time.
7+
8+
name: Check API data in sync
9+
on: [push, pull_request]
10+
11+
jobs:
12+
check-api-data-in-sync:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-node@v2
17+
with:
18+
node-version: 16
19+
# Don't cache because we don't fully bootstrap
20+
21+
- run: npm ci
22+
- run: npx lerna bootstrap --scope lit-dev-api --include-dependencies
23+
- run: npx lerna run build --scope lit-dev-api --include-dependencies
24+
- run: command test -z "$(git status --porcelain)"

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ packages/lit-dev-content/temp
1212
packages/lit-dev-content/samples/js
1313

1414
packages/lit-dev-api/lit/
15-
packages/lit-dev-api/api-data/**/*
16-
!packages/lit-dev-api/api-data/.gitkeep
1715

1816
# We only want to keep '-linux' screenshots which are tested by Github Actions.
1917
packages/lit-dev-tests/src/playwright/**/*.png

Dockerfile

+1-6
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@ COPY packages/lit-dev-tools-esm/ ./packages/lit-dev-tools-esm/
3535
COPY packages/lit-dev-server/ ./packages/lit-dev-server/
3636
RUN npx lerna run build:ts --scope lit-dev-tools-cjs --scope lit-dev-tools-esm --scope lit-dev-server --stream
3737

38-
# Generated API docs
38+
# Pre-generated API docs data
3939
COPY packages/lit-dev-api/ ./packages/lit-dev-api/
40-
RUN npx lerna run build --scope lit-dev-api --stream && \
41-
# By cloning and deleting the Lit monorepo checkout all within the same RUN
42-
# command, we avoid ever including any Lit monorepo files in our Docker
43-
# filesystem layers.
44-
rm -rf packages/lit-dev-api/lit/
4540

4641
# Site content
4742
COPY packages/lit-dev-content/ ./packages/lit-dev-content/

0 commit comments

Comments
 (0)