Skip to content

Commit

Permalink
docs: document ci/cd and run linting on ci - ADMT-210 (#1532)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelovicentegc authored Mar 27, 2024
2 parents b935e7d + 714d6c2 commit db359af
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ storybook-static

# Resolve: Expected exception block, space or tab after '//' in comment
examples/shoreline-nextjs-integration/next-env.d.ts
examples/next-14x/next-env.d.ts

# Resolve: ES2015 module syntax is preferred over namespaces
packages/docs-generator/src/json-parser
packages/docs-generator/src/json-parser

# Resolve: No named exports found in module './tokens' TODO needs to be fixed
packages/theme-sunrise/src/index.ts
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @vtex/admin-ui
* @vtex/admin-team
23 changes: 16 additions & 7 deletions .github/workflows/ci.yml → .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# This Action should run on each PR by verifying if they pass on lint, test and build
name: CI
name: Pull Request workflow

on:
push:
branches-ignore:
- main
- dev
pull_request:
types: [opened, reopened, synchronize, edited]

jobs:
build:
name: Shoreline
name: Build and test all packages
timeout-minutes: 15
runs-on: ubuntu-latest
if: ${{ github.event.action != 'edited' }}

steps:
- name: Checkout code
Expand All @@ -36,6 +34,9 @@ jobs:
- name: Build
run: pnpm build

- name: Code lint
run: pnpm lint

- name: Stylelint
run: pnpm stylelint **/*.css

Expand All @@ -52,3 +53,11 @@ jobs:
buildScriptName: build:storybook:ci
exitOnceUploaded: true
exitZeroOnChanges: true

semantic-pr:
name: Validate PR title for semantic versioning
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CD
name: Release workflow

on:
push:
Expand All @@ -10,8 +10,6 @@ jobs:
name: Shoreline
timeout-minutes: 15
runs-on: ubuntu-latest
outputs:
storybookUrl: ${{ steps.publish-to-chromatic.outputs.storybookUrl }}

steps:
- name: Check out code
Expand Down Expand Up @@ -114,7 +112,7 @@ jobs:

- name: Generate Documentation
env:
STORYBOOK_URL: ${{needs.build.outputs.storybookUrl}}
STORYBOOK_URL: 'https://shoreline.storybook.vtex.com'
run: |
if git log -1 --pretty=%B | grep -q "\[skip-ci\]"; then
exit 0
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Shoreline is a set of tools designed specifically to enhance the experience of d
- [Components](#components)
- [What about tests?](#what-about-tests)
- [Where does all Storybook stories go?](#where-does-all-storybook-stories-go)
- [How does our CI/CD works?](#how-does-our-cicd-works)
- [Pull Request workflow](#pull-request-workflow)
- [Release workflow](#release-workflow)

## How to develop locally?

Expand Down Expand Up @@ -48,3 +51,35 @@ All Shoreline components are tested by default. We have a CI/CD in place which t
We use [Chromatic](https://www.chromatic.com/) to power our Storybook documentation. This is the tool that takes screenshots of all our stories and compares them to the previous version of our Storybook to make sure that we are not introducing any unexpected visual regression to our components.

We also make a responsible use of Chromatic, by taking snapshots of our components from a single story containing all possible variations of a component, instead of taking snapshots of every single story. This is a good practice that helps us keep our Storybook documentation lean and easy to navigate. Now go back and read our [Storybook guidelines](https://github.com/vtex/shoreline/issues/1455).

## How does our CI/CD works?

We use GitHub Actions to run our CI/CD. We have a robust workflow that runs every time a:

1. PR is opened
2. PR is merged

These workflows ensure that our code is always up to date and that we are not introducing any unexpected issues to our packages, as well as automates the process of generating the docs site, publishing new versions of our packages to NPM and deploying our storybook stories to Chromatic. Vercel takes care of deploying our docs website on a pipeline that runs in parallel with ours.

### Pull Request workflow

Our [Pull Request workflow](.github/workflows/pr.yml) runs the following steps:

1. Validates the PR title according to semantic commit rules to ensure that we are able to generate release notes from it
2. Builds all packages, ensuring their build is ok
3. Lints all JavaScript, TypeScript, and CSS files
4. Runs unit tests for all packages
5. Run interaction tests for all components
6. Publishes the components package to Chromatic, which in turn will run visual tests

### Release workflow

Our [Release workflow](.github/workflows/release.yml) runs the following steps:

1. Builds all packages, ensuring their build is ok
2. Stores the build artifacts on a temporary cache
3. Publishes the components package to Chromatic
4. Publishes all publishable packages to NPM
5. Retrieves the build artifacts from the cache
6. Generates a new version of the docs website from the retrieved build artifacts
<!-- 7. TODO: Generates a release note -->

0 comments on commit db359af

Please sign in to comment.