Skip to content

Commit

Permalink
Configure tooling and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryuni committed Jan 6, 2024
1 parent fd3d018 commit 54ed88a
Show file tree
Hide file tree
Showing 12 changed files with 1,287 additions and 330 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/*.d.ts
packages/**/*.min.js
packages/**/dist/**/*
examples/**/*
.github
.changeset
9 changes: 9 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://github.com/actions/labeler

automation:
- .github/workflows/**

workspace:
# Any config file at the root
- '*.{js,json}'
- '.*'
128 changes: 128 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- main
merge_group:
pull_request:
paths-ignore:
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"

# Automatically cancel older in-progress jobs on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
# TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
FORCE_COLOR: true
ASTRO_TELEMETRY_DISABLED: true
# 7 GiB by default on GitHub, setting to 6 GiB
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: --max-old-space-size=6144

jobs:
# Build primes out Turbo build cache and pnpm cache
build:
name: "Build - Node ${{ matrix.NODE_VERSION }}"
runs-on: ubuntu-latest
timeout-minutes: 3
strategy:
matrix:
NODE_VERSION: [18, 20]
fail-fast: true
steps:
# # Disable crlf so all OS can share the same Turbo cache
# # https://github.com/actions/checkout/issues/135
# - name: Disable git crlf
# run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2

- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@main
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build Packages
run: pnpm run build

lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build Packages
run: pnpm run build

- name: Lint
run: pnpm run lint

- name: Format Check
run: pnpm run format --check

test:
name: "Test: Node ${{ matrix.NODE_VERSION }}"
runs-on: ubuntu-latest
timeout-minutes: 25
needs: build
strategy:
matrix:
NODE_VERSION: [18, 20]
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2

- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build Packages
run: pnpm run build

- name: Test
run: pnpm run test

15 changes: 15 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Automatically labels PRs based on the configuration file
# you are probably looking for 👉 `.github/labeler.yml`
name: Label PRs

on:
- pull_request_target

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
branches:
- main

defaults:
run:
shell: bash

env:
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
# TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
FORCE_COLOR: true

jobs:
changelog:
name: Changelog PR or Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v2

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build Packages
run: pnpm run build

- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
# Note: pnpm install after versioning is necessary to refresh lockfile
version: pnpm run version
publish: pnpm exec changeset publish
commit: "[ci] release"
title: "[ci] release"
env:
# Needs access to push to main
GITHUB_TOKEN: ${{ secrets.COMMIT_TOKEN }}
# Needs access to publish to npm
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

103 changes: 11 additions & 92 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,108 +23,27 @@ lib-cov
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
# Caches
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache
.turbo/
.pnpm-store
.parcel-cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# dotenv environment variable files
.env
*.env
.env.*

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# IDEs stuff
.idea
.vscode
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Copied directly from Astro's monorepo at:
### https://github.com/withastro/astro/blob/24663c9695385fed9ece57bf4aecdca3a8581e70/.prettierignore

# Deep Directories
**/dist
**/smoke
**/node_modules
**/fixtures
**/vendor
**/.vercel

# Directories
.github
.changeset

# Files
pnpm-lock.yaml
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@
"format:code": "prettier -w \"**/*\" --ignore-unknown --cache",
"format:imports": "organize-imports-cli ./packages/*/tsconfig.json ./packages/*/*/tsconfig.json",
"release": "pnpm run build && changeset publish",
"lint": "eslint . --report-unused-disable-directives",
"version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run format",
"test": "turbo run test --concurrency=1"
},
"dependencies": {},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@types/node": "^20.10.6",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"esbuild": "^0.19.11",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.1.2",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.1.1",
"prettier-plugin-astro": "^0.12.3",
Expand Down
Loading

0 comments on commit 54ed88a

Please sign in to comment.