Skip to content

Commit

Permalink
feat: improved ci process (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp authored Jan 6, 2023
1 parent 28f8ec1 commit 1a3aef6
Show file tree
Hide file tree
Showing 28 changed files with 687 additions and 444 deletions.
35 changes: 35 additions & 0 deletions .github/actions/pnpm-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: 'Monorepo install (pnpm)'
description: 'Run pnpm install'

runs:
using: 'composite'

steps:
- name: Expose pnpm config(s) through "$GITHUB_OUTPUT"
id: pnpm-config
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache rotation keys
id: cache-rotation
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
echo "YEAR_WEEK=$(/bin/date -u "+%Y%W")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
id: pnpm-store-cache
with:
path: ${{ steps.pnpm-config.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_WEEK }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_WEEK }}-
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile --strict-peer-dependencies --prefer-offline
env:
HUSKY: '0'
25 changes: 0 additions & 25 deletions .github/dependabot.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/auto-merge.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/auto-rebase.yml

This file was deleted.

90 changes: 90 additions & 0 deletions .github/workflows/ci-apps-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
name: CI for Docs App

on: # yamllint disable-line rule:truthy
push:
branches:
- master
- develop
# Only consider those paths to trigger the action
paths:
- 'apps/docs/**'
- 'packages/**'
- 'package.json'
- 'pnpm*'
- '.github/**'
- 'tsconfig.base.json'

pull_request:
types:
- opened
- synchronize
- reopened
# Only consider those paths to trigger the action
paths:
- 'apps/docs/**'
- 'packages/**'
- 'package.json'
- 'pnpm*'
- '.github/**'
- 'tsconfig.base.json'

jobs:
integration:
name: Node ${{ matrix.node }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ['ubuntu-22.04']
node: ['18']
pnpm: ['7']
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: ${{ matrix.pnpm }}
run_install: false

- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org/'

- name: 📥 Monorepo install
uses: ./.github/actions/pnpm-install

# see https://github.com/vercel/next.js/pull/27362
- name: Restore "web" app build from cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/apps/docs/.next/cache
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: ${{ runner.os }}-web-${{ hashFiles('pnpm*.yaml') }}-${{ hashFiles('apps/docs/src/**.[jt]sx?', 'apps/docs/src/**.json') }}
restore-keys: |
${{ runner.os }}-web-${{ hashFiles('pnpm*.yaml') }}-
- name: Typecheck
working-directory: apps/web
run: |
pnpm lint:types
- name: Linter
working-directory: apps/web
run: |
pnpm lint
- name: Build docs-app
working-directory: apps/web
run: |
pnpm --filter=docs build
113 changes: 113 additions & 0 deletions .github/workflows/ci-apps-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
name: CI for Web App

on: # yamllint disable-line rule:truthy
push:
branches:
- master
- develop
# Only consider those paths to trigger the action
paths:
- 'apps/web/**'
- 'packages/**'
- 'package.json'
- 'pnpm*'
- '.github/**'
- 'tsconfig.base.json'

pull_request:
types:
- opened
- synchronize
- reopened
# Only consider those paths to trigger the action
paths:
- 'apps/web/**'
- 'packages/**'
- 'package.json'
- 'pnpm*'
- '.github/**'
- 'tsconfig.base.json'

jobs:
integration:
name: Node ${{ matrix.node }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ['ubuntu-22.04']
node: ['18']
pnpm: ['7']
steps:
- name: Check out the codebase
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: ${{ matrix.pnpm }}
run_install: false

- name: Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org/'

- name: 📥 Monorepo install
uses: ./.github/actions/pnpm-install

# see https://github.com/vercel/next.js/pull/27362
- name: Restore "web" app build from cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/apps/web/.next/cache
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: ${{ runner.os }}-web-${{ hashFiles('pnpm*.yaml') }}-${{ hashFiles('apps/web/src/**.[jt]sx?', 'apps/web/src/**.json') }}
restore-keys: |
${{ runner.os }}-web-${{ hashFiles('pnpm*.yaml') }}-
- name: Typecheck
working-directory: apps/web
run: |
pnpm lint:types
- name: Linter
working-directory: apps/web
run: |
pnpm lint
- name: Build web-app
working-directory: apps/web
run: |
pnpm --filter=web build
env:
# Speed up build: they are linted in a previous step
NEXT_IGNORE_ESLINT: true
# Speed up build: they are type-checked in a previous step
NEXT_IGNORE_TYPECHECK: true
# Speed up build: don't run if not needed, enable if it becomes needed
NEXT_DISABLE_SOURCEMAPS: true
# Don't send telemetry for ci
NEXT_TELEMETRY_DISABLED: true
# To allow checking size-limits
NEXT_DISABLE_SENTRY: false
# Fully disable sentry upload
NEXT_SENTRY_UPLOAD_DRY_RUN: true

- name: 📉 Check browser bundle size limits
working-directory: apps/web
run: |
pnpm --filter=web lint:size
- name: 🌎 Ecmascript checks for build files
working-directory: apps/web
run: |
pnpm --filter=web lint:dist
Loading

2 comments on commit 1a3aef6

@vercel
Copy link

@vercel vercel bot commented on 1a3aef6 Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-starter-tpl-web – ./apps/web

next-starter-tpl-web-wayofdev.vercel.app
next-starter-tpl-web-git-master-wayofdev.vercel.app
next-starter-tpl-web.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 1a3aef6 Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

next-starter-tpl-docs – ./apps/docs

next-starter-tpl-docs.vercel.app
next-starter-tpl-docs-wayofdev.vercel.app
next-starter-tpl-docs-git-master-wayofdev.vercel.app

Please sign in to comment.