|
1 | 1 | # Stencil Continuous Integration (CI) |
2 | 2 |
|
3 | | -Continuous integration (CI) is an important aspect of any project, and is used to verify and validate the changes to the |
4 | | -codebase work as intended, to avoid introducing regressions (bugs), and to adhere to coding standards (e.g. formatting |
5 | | -rules). It provides a consistent means of performing a series of checks over the entire codebase on behalf of the team. |
6 | | - |
7 | | -This document explains Stencil's CI setup. |
| 3 | +This document explains Stencil's CI setup for the v5 monorepo. |
8 | 4 |
|
9 | 5 | ## CI Environment |
10 | 6 |
|
11 | | -Stencil's CI system runs on GitHub Actions. |
12 | | -GitHub Actions allow developers to declare a series of _workflows_ to run following an _event_ in the repository, or on |
13 | | -a set schedule. |
14 | | - |
15 | | -The workflows that are run as a part of Stencil's CI process are declared as YAML files, and are stored in the same |
16 | | -directory as this file. |
17 | | -Each workflow file is explained in greater depth in the [workflows section](#workflows) of this document. |
| 7 | +Stencil's CI runs on GitHub Actions using pnpm and supports Node.js 22 and 24. |
18 | 8 |
|
19 | | -## Workflows |
| 9 | +## Workflow Structure |
20 | 10 |
|
21 | | -This section describes each of Stencil's GitHub Actions workflows. |
22 | | -Each of these tasks below are codified as [reusable workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows). |
| 11 | +```mermaid |
| 12 | +graph TD; |
| 13 | + quality[Quality] |
| 14 | + build[Build] |
| 15 | + unit[Unit Tests] |
| 16 | +
|
| 17 | + quality --> |parallel| build |
| 18 | + build --> unit |
| 19 | +
|
| 20 | + unit --> test-build[Build Tests] |
| 21 | + unit --> test-integration[Integration Tests] |
| 22 | + unit --> test-runtime[Runtime Tests] |
| 23 | + unit --> test-special-config[Special Config Tests] |
| 24 | + unit --> test-ssr[SSR Tests] |
| 25 | + unit --> test-starter[Component Starter] |
| 26 | +``` |
23 | 27 |
|
24 | | -Generally speaking, workflows are designed to be declarative in nature. |
25 | | -As such, this section does not intend to duplicate the details of each workflow, but rather give a high level overview |
26 | | -of each one and mention nuances of each. |
| 28 | +## Workflows |
27 | 29 |
|
28 | 30 | ### Main (`main.yml`) |
29 | 31 |
|
30 | | -The main workflow for Stencil can be found in `main.yml` in this directory. |
31 | | -This workflow is the entrypoint of Stencil's CI system, and initializes every workflow & job that runs. |
32 | | - |
33 | | -### Build (`build.yml`) |
34 | | - |
35 | | -This workflow is responsible for building Stencil and validating the resultant artifact. |
36 | | - |
37 | | -### Format (`format.yml`) |
38 | | - |
39 | | -This workflow is responsible for validating that the code adheres to the Stencil team's formatting configuration before |
40 | | -a pull request is merged. |
41 | | - |
42 | | -### Dev Release (`release-dev.yml`) |
43 | | - |
44 | | -This workflow initiates a developer build of Stencil from the `main` branch. |
45 | | -It is intended to be manually invoked by a member of the Stencil team. |
46 | | - |
47 | | -### Nightly Release (`release-nightly.yml`) |
48 | | - |
49 | | -This workflow initiates a nightly build of Stencil from the `main` branch. |
50 | | -A nightly build is similar to a 'Dev Release', except that: |
51 | | -- it is run on a set cadence (it is not expectedthat a developer to manually invoke it) |
52 | | -- it is published to the npm registry under the 'nightly' tag |
| 32 | +The orchestrator workflow that runs on push to `main`/`v5` branches and on pull requests. |
53 | 33 |
|
54 | | -### Test Analysis (`test-analysis.yml`) |
| 34 | +### Quality (`quality.yml`) |
55 | 35 |
|
56 | | -This workflow is responsible for running the Stencil analysis testing suite. |
| 36 | +Runs quality checks (Linux only): |
| 37 | +- `pnpm format:check` - Code formatting (oxfmt) |
| 38 | +- `pnpm lint:check` - Linting (oxlint) |
| 39 | +- `pnpm typecheck` - TypeScript type checking |
| 40 | +- `pnpm knip` - Unused code detection |
57 | 41 |
|
58 | | -### Test End-to-End (`test-e2e.yml`) |
59 | | - |
60 | | -This workflow is responsible for running the Stencil end-to-end testing suite. |
61 | | -This suite does _not_ run Stencil's BrowserStack tests. |
62 | | -Those are handled by a [separate workflow](#browserstack-browserstackyml). |
63 | | - |
64 | | -### Test Unit (`test-unit.yml`) |
65 | | - |
66 | | -This workflow is responsible for running the Stencil unit testing suite. |
67 | | - |
68 | | -### WebdriverIO Tests (`test-wdio.yml`) |
69 | | - |
70 | | -This workflow runs our integration tests which assert that various Stencil |
71 | | -features work correctly when components using them are built and then rendered |
72 | | -in actual browsers. We run these tests using |
73 | | -[WebdriverIO](https://webdriver.io/) against Firefox, Chrome, and Edge. |
74 | | - |
75 | | -For more information on how those tests are set up please see the [WebdriverIO |
76 | | -test README](../../test/wdio/README.md). |
77 | | - |
78 | | -### Design |
79 | | - |
80 | | -#### Overview |
| 42 | +### Build (`build.yml`) |
81 | 43 |
|
82 | | -Most of the workflows above are contingent on the build finishing (otherwise there would be nothing to run against). |
83 | | -The diagram below displays the dependencies between each workflow. |
| 44 | +Builds all packages and uploads artifacts for downstream jobs. |
84 | 45 |
|
85 | | -```mermaid |
86 | | -graph LR; |
87 | | - build-core-->test-analysis; |
88 | | - build-core-->test-e2e; |
89 | | - build-core-->test-unit; |
90 | | - format; |
91 | | -``` |
| 46 | +### Test Workflows |
92 | 47 |
|
93 | | -Making each 'task' a reusable workflow allows CI to run more jobs in parallel, improving the throughput of Stencil's CI. |
94 | | -All resusable workflows can be found in the [workflows directory](.). |
95 | | -This is a GitHub Actions convention that cannot be overridden. |
| 48 | +All test workflows run on a matrix of: |
| 49 | +- **OS**: Ubuntu, Windows |
| 50 | +- **Node**: 22, 24 |
96 | 51 |
|
97 | | -#### Running Tests |
| 52 | +| Workflow | Description | |
| 53 | +|----------|-------------| |
| 54 | +| `test-unit.yml` | Unit tests for packages (`pnpm test`) | |
| 55 | +| `test-build.yml` | Build test suite (`test/build`) | |
| 56 | +| `test-integration.yml` | Integration tests (`test/integration`) | |
| 57 | +| `test-runtime.yml` | Runtime tests (`test/runtime`) | |
| 58 | +| `test-special-config.yml` | Special config tests (`test/special-config`) | |
| 59 | +| `test-ssr.yml` | SSR tests (`test/ssr`) | |
| 60 | +| `test-component-starter.yml` | Smoke test with component starter template | |
98 | 61 |
|
99 | | -All test-related jobs require the build to finish first. |
100 | | -Upon successful completion of the build workflow, each test workflow will start. |
| 62 | +## Release Workflows |
101 | 63 |
|
102 | | -The test-running workflows have been designed to run in parallel and are configured to run against several operating |
103 | | -systems & versions of node. |
104 | | -For a test workflow that theoretically runs on Ubuntu and Windows operating systems and targets Node v14, v16 and v18, a |
105 | | -single test workflow may spawn several jobs: |
106 | | - |
107 | | -```mermaid |
108 | | -graph LR; |
109 | | - test-analysis-->ubuntu-node14; |
110 | | - test-analysis-->ubuntu-node16; |
111 | | - test-analysis-->ubuntu-node18; |
112 | | - test-analysis-->windows-node14; |
113 | | - test-analysis-->windows-node16; |
114 | | - test-analysis-->windows-node18; |
115 | | -``` |
| 64 | +Release workflows are managed separately and support both v4 (legacy) and v5 (monorepo with changesets). |
116 | 65 |
|
117 | | -These 'os-node jobs' (e.g. `ubuntu-node16`) are designed to _not_ prematurely stop their sibling jobs should one of |
118 | | -them fail. |
119 | | -This allows the opportunity for the sibling test jobs to potentially pass, and reduce the number of runners that need to |
120 | | -be spun up again should a developer wish to 're-run failed jobs'. |
121 | | -Should a developer feel that it is more appropriate to re-run all os-node jobs, they may do so using GitHub's 're-run |
122 | | -all jobs' options in the GitHub Actions UI. |
| 66 | +| Workflow | Description | |
| 67 | +|----------|-------------| |
| 68 | +| `release-dev.yml` | Developer builds from main | |
| 69 | +| `release-nightly.yml` | Nightly builds | |
| 70 | +| `release-production.yml` | Production releases | |
| 71 | +| `publish-npm.yml` | NPM publishing | |
123 | 72 |
|
124 | | -#### Concurrency |
| 73 | +## Test Matrix |
125 | 74 |
|
126 | | -When a `git push` is made to a branch, Stencil's CI is designed to stop existing job(s) associated with the workflow + |
127 | | -branch. |
128 | | -A new CI run (of each workflow) will begin upon stopping the existing job(s) using the new `HEAD` of the branch. |
| 75 | +All test workflows use `fail-fast: false` so sibling jobs continue even if one fails. This reduces the need to re-run all jobs when investigating failures. |
129 | 76 |
|
130 | | -## Repository Configuration |
| 77 | +## Concurrency |
131 | 78 |
|
132 | | -Each of the workflows described in the [workflows section](#workflows) of this document must be configured in the |
133 | | -Stencil GitHub repository to be _required_ to pass in order to land code in the `main` branch. |
| 79 | +When a `git push` is made to a branch, existing CI jobs for that branch are cancelled and a new run begins. |
0 commit comments