This page contains the setup guide for the previous version of the agent (v4). Go to agent v5 to follow the setup guide for the latest stable version.
Step 1. Install
npm install --save-dev @relative-ci/agentyarn add --dev @relative-ci/agentpnpm add -D @relative-ci/agentStep 2. Output webpack stats JSON file
Follow the steps on Output webpack stats JSON file guide.
Step 3. Configure @relative-ci/agent
module.exports = { // Get current commit message (`git log -1 --pretty=%B`) and send it to RelativeCI as part of the build informatin includeCommitMessage: true, // Save agent payload to disk for debugging // @example './relative-ci-payload.json', payloadFilepath: undefined, webpack: { // Path to Webpack stats JSON file stats: './webpack-stats.json', },};Step 4. Configure CI service
Add environment variables
More resources:
Run agent CLI on CI
Add a CI job to run @relative-ci/agent after the build job.
View config examples for:
Monorepo
If you are using a monorepo setup and need to send the build information and the stats for multiple projects, use different API keys and stat files for each project.
# ...
- name: Project A - build run: cd project-a && npm run build --json webpack-stats.json
- name: Project A - send build information and bundle stats to RelativeCI run: cd project-a && npx relative-ci-agent env: RELATIVE_CI_KEY: ${{ secrets.RELATIVE_CI_KEY_PROJECT_A }}
- name: Project B - build run: cd project-b && npm run build --json webpack-stats.json
- name: Project B - send build information and bundle stats to RelativeCI run: cd project-b && npx relative-ci-agent env: RELATIVE_CI_KEY: ${{ secrets.RELATIVE_CI_KEY_PROJECT_B }}