Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEXT-33446 - add basic CI pipeline #1

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
34ad06e
NEXT-33446 - add basic CI pipeline
Haberkamp Feb 5, 2024
df4ab8c
NEXT-33446 - add command to check formatting
Haberkamp Feb 5, 2024
65c66bf
NEXT-33446 - check formatting in CI pipeline
Haberkamp Feb 5, 2024
e8cf63a
NEXT-33446 - rename script from test to test:unit
Haberkamp Feb 5, 2024
0c210f5
NEXT-33446 - add job for unit testing
Haberkamp Feb 5, 2024
bab63d2
NEXT-33446 - bump up node version to 20 in CI
Haberkamp Feb 5, 2024
ef8c8c9
NEXT-33446 - disable cache in ci
Haberkamp Feb 5, 2024
0390cf9
NEXT-33446 - run storybook tests in CI pipeline
Haberkamp Feb 5, 2024
b44efd7
NEXT-33446 - update path to node_modules folder
Haberkamp Feb 5, 2024
673a965
NEXT-33446 - update path to node_modules folder
Haberkamp Feb 5, 2024
d85f220
NEXT-33446 - add preview job
Haberkamp Feb 5, 2024
a4771fb
NEXT-33446 - comment out job for storybook tests
Haberkamp Feb 5, 2024
b0b9583
NEXT-33446 - add job for deploying preview
Haberkamp Feb 5, 2024
8b19e88
NEXT-33446 - add job for chromatic
Haberkamp Feb 5, 2024
5ffc9af
NEXT-33446 - add job publishing component library to npm
Haberkamp Feb 5, 2024
7fea251
NEXT-33446 - bump up node version for deploy-preview job
Haberkamp Feb 5, 2024
f00aced
NEXT-33446 - fix vue-template-compiler version mismatch
Haberkamp Feb 5, 2024
603e26a
NEXT-33446 - bump up actions/checkout version to v4
Haberkamp Feb 5, 2024
f81ad03
NEXT-33446 - remove unnecessary pull request configuration in test wo…
Haberkamp Feb 5, 2024
75c89c8
NEXT-33446 - run test workflow after merge on main branch
Haberkamp Feb 5, 2024
c116801
NEXT-33446 - bump up version of actions/setup-node to v4
Haberkamp Feb 5, 2024
8fee590
NEXT-33446 - enable node_modules caching
Haberkamp Feb 5, 2024
302b1e9
NEXT-33446 - remove .github directory in component-library
Haberkamp Feb 5, 2024
848a5a1
NEXT-33446 - move LICENSE.md file to root of project
Haberkamp Feb 5, 2024
07ea8a0
NEXT-33446 - add test:unit:watch command
Haberkamp Feb 5, 2024
0de89de
NEXT-33446 - fix lint:all command in root package.json
Haberkamp Feb 5, 2024
30279b8
NEXT-33446 - add build command to turbo
Haberkamp Feb 5, 2024
5bc4b18
NEXT-33446 - fix typo in comment
Haberkamp Feb 6, 2024
6ed6160
NEXT-33446 - pin vue to 2.7.10
Haberkamp Feb 6, 2024
a7f2fda
NEXT-33446 - disable node_modules caching in certian jobs
Haberkamp Feb 6, 2024
e1890f1
wip
Haberkamp Feb 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
name: 'Chromatic'

on:
on:
push:
branches:
- main

# List of jobs
jobs:
chromatic-deployment:
# Operating System
runs-on: ubuntu-latest
# Job steps
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for the chromatic CLI to work

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Retrieve the cached main "node_modules" directory (if present)
uses: actions/cache@v3
id: node-cache-main
with:
path: node_modules
key: node-modules-main-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install main dependencies (if the cached directory was not found)
if: steps.node-cache-main.outputs.cache-hit != 'true'
run: npm ci
Expand All @@ -39,4 +36,3 @@ jobs:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
zip: true
allowConsoleErrors: true

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Deployment

on:
on:
push:
branches:
- main
Expand All @@ -10,26 +10,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Retrieve the cached main "node_modules" directory (if present)
uses: actions/cache@v3
id: node-cache-main
with:
path: node_modules
key: node-modules-main-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install main dependencies (if the cached directory was not found)
if: steps.node-cache-main.outputs.cache-hit != 'true'
run: npm ci

- name: Create the static pages directory locally in CI
run: npm run build-storybook
run: npm --prefix ./packages/component-library run build-storybook

- name: Deploy 🚀
if: github.ref == 'refs/heads/main'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish to NPM

on:
on:
push:
branches:
- main
Expand All @@ -11,23 +11,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Retrieve the cached "node_modules" directory (if present)
uses: actions/cache@v3
id: node-cache
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies (if the cached directory was not found)
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Build distributed files
run: npm run build-vue
run: npm --prefix ./packages/component-library run build-vue
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: "public"
access: 'public'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Deploy PR previews

on:
on:
pull_request:
types:
- opened
Expand All @@ -15,28 +15,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- name: Retrieve the cached main "node_modules" directory (if present)
uses: actions/cache@v3
id: node-cache-main
with:
path: node_modules
key: node-modules-main-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install main dependencies (if the cached directory was not found)
if: steps.node-cache-main.outputs.cache-hit != 'true'
# if: steps.node-cache-main.outputs.cache-hit != 'true'
run: npm ci

- name: Create the static pages directory locally in CI
run: npm run build-storybook
run: npm --prefix ./packages/component-library run build-storybook

- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./storybook-static/
source-dir: ./packages/component-library/storybook-static/
112 changes: 112 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Tests

on:
pull_request:
Haberkamp marked this conversation as resolved.
Show resolved Hide resolved

push:
branches:
- main

workflow_dispatch:

jobs:
static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Retrieve the cached "node_modules" directory (if present)
uses: actions/cache@v3
id: node-cache
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies (if the cached directory was not found)
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Check formatting
run: npm run format:check

- name: Perform typecheck
run: npm run lint:types

- name: Lint code
run: npm run lint:eslint

unit-tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

# - name: Retrieve the cached "node_modules" directory (if present)
# uses: actions/cache@v3
# id: node-cache
# with:
# path: node_modules
# key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies (if the cached directory was not found)
# if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci

- name: unit
run: npm run test:unit

storybook-tests:
name: Storybook Tests
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4

# - name: Retrieve the cached "node_modules" directory (if present)
# uses: actions/cache@v3
# id: node-cache
# with:
# path: node_modules
# key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies (if the cached directory was not found)
# if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Install Playwright
run: npx playwright install

- name: Create the static pages directory locally in CI
run: npm --prefix ./packages/component-library run build-storybook

- name: Run Tests
id: storybookTests
run: |
cd ./packages/component-library &&
npx concurrently --kill-others --success first --names "SB,TEST" --prefix-colors "magenta,blue" \
"http-server storybook-static -a 127.0.0.1 --port 6006" \
"wait-on http://127.0.0.1:6006 && npm run test-storybook"

- name: Archive visual test diffs
uses: actions/upload-artifact@v3
if: always()
with:
name: visual-test-diffs
path: ./packages/component-library/__snapshots__
File renamed without changes.
Loading
Loading