|
| 1 | +# Continuous Integration (CI) |
| 2 | + |
| 3 | +Running various checks in CI can be handled by Compas as well. |
| 4 | + |
| 5 | +::: code-group |
| 6 | + |
| 7 | +```shell [GitHub] |
| 8 | +compas init github |
| 9 | +# Overwrites `.github/workflows/check.yml` |
| 10 | +``` |
| 11 | + |
| 12 | +::: |
| 13 | + |
| 14 | +The supported templates checkout the repository, configure cache when applicable |
| 15 | +and then start Compas via `compas ci`. If the CI provider that you want to use |
| 16 | +is not listed, try to mimic the following Shell commands: |
| 17 | + |
| 18 | +```shell |
| 19 | +# Either install packages via the package manager that you use and invoke Compas |
| 20 | +npm ci |
| 21 | +npx compas ci |
| 22 | + |
| 23 | +# OR let Compas infer the used package manager and install packages for you. |
| 24 | + |
| 25 | +# Retrieve the used Compas version from the package.json (e.g 0.8.0 or latest). |
| 26 | +COMPAS_VERSION=$(jq --raw-output '.devDependencies.compas // .dependencies.compas // "latest" | ltrimstr("v")' package.json) |
| 27 | +npx compas@$COMPAS_VERSION ci |
| 28 | +``` |
| 29 | + |
| 30 | +## Steps |
| 31 | + |
| 32 | +- **Package manager**: Compas starts with the package installation command of |
| 33 | + the inferred package manager. |
| 34 | +- **Docker**: Required Docker containers are started, when specified in the |
| 35 | + configs. |
| 36 | +- **Migrations**: If migrations are enabled, they will be executed. |
| 37 | +- **Format and linting**: Supported linters like Prettier and ESLint are |
| 38 | + executed |
| 39 | +- **Tests**: If a test command is inferred or found in the config, it is |
| 40 | + executed. |
| 41 | + |
| 42 | +## Multiple repositories |
| 43 | + |
| 44 | +The default CI templates provided by Compas only checkout the current |
| 45 | +repository. If things like tests require multiple checked out repositories to |
| 46 | +get a complete workspace, please edit the templates manually. |
0 commit comments