Skip to content

Instantly share code, notes, and snippets.

@eeshdarthvader
Created March 30, 2022 21:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eeshdarthvader/8513e7fe308fbab089fa6603b55bb8aa to your computer and use it in GitHub Desktop.
Save eeshdarthvader/8513e7fe308fbab089fa6603b55bb8aa to your computer and use it in GitHub Desktop.
name: CI
on: pull_request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HUSKY_SKIP_INSTALL: true
jobs:
cleanup-run:
runs-on: ubuntu-18.04
steps:
- name: Abort previous action run
uses: rokroskar/workflow-run-cleanup-action@v0.3.3
eslint:
name: Code quality
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2.1.5
with:
node-version: 14
- name: Restore node_modules cache
uses: actions/cache@v2.1.5
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v2
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- name: Install packages
run: yarn --frozen-lockfile
- name: ESLint
run: yarn eslint
typecheck:
name: Type check
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2.1.5
with:
node-version: 14
- name: Restore node_modules cache
uses: actions/cache@v2.1.5
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v2
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- name: Install packages
run: yarn --frozen-lockfile
- name: Type check
run: yarn typecheck --cache-dir=".turbo"
tests:
name: Unit tests
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v2.1.5
with:
node-version: 14
- name: Restore node_modules cache
uses: actions/cache@v2.1.5
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v2
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- name: Install packages
run: yarn --frozen-lockfile
- name: All tests
run: yarn test-coverage --cache-dir=".turbo"
- name: Add coverage comment
continue-on-error: true
uses: eeshdarthvader/code-coverage-assistant@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
monorepo-base-path: './packages'
build:
name: Transpile code
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v2.1.5
with:
node-version: 14
- name: Restore node_modules cache
uses: actions/cache@v2.1.5
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install packages
run: yarn --frozen-lockfile
check-changesets:
name: Check for changesets
if: startsWith(github.head_ref, 'changeset-release/master') == false
runs-on: ubuntu-18.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v2.1.5
with:
node-version: 14
- name: Restore node_modules cache
uses: actions/cache@v2.1.5
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install packages
run: yarn --frozen-lockfile
- name: Check for changesets
run: yarn check-changeset
- if: failure()
name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
🦋 Add changesets or use `yarn changeset --empty` for no-release
edit-mode: replace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment