Skip to content

Commit

Permalink
chore(ci): setup CI and husky
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Jun 27, 2024
1 parent b2016d3 commit 05e6e04
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [tresjs, alvarosabu]
ko_fi: alvarosaburido
64 changes: 64 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Bug report 🐛
description: Report an issue with TresJS XR
labels: [pending triage]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
placeholder: I am doing ... What I expect is ... What actually happening is ...
validations:
required: true
- type: input
id: reproduction
attributes:
label: Reproduction
description: Please provide a link via [stackblitz](https://stackblitz.com/edit/tresjs-minimal-reproduction) or a link to a repo that can reproduce the problem you ran into. A [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) is required ([Why?](https://antfu.me/posts/why-reproductions-are-required)). If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "need reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed.
placeholder: Reproduction URL
validations:
required: true
- type: textarea
id: reproduction-steps
attributes:
label: Steps to reproduce
description: Please provide any reproduction steps that may need to be described. E.g. if it happens only when running the dev or build script make sure it's clear which one to use.
placeholder: Run `npm install` followed by `npm run dev`
- type: textarea
id: system-info
attributes:
label: System Info
description: Output of `npx envinfo --system --npmPackages '{vite,@tresjs/*, three, vue}' --binaries --browsers`
render: shell
placeholder: System, Binaries, Browsers
- type: dropdown
id: package-manager
attributes:
label: Used Package Manager
description: Select the used package manager
options:
- npm
- yarn
- pnpm
validations:
required: true
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, please make sure you do the following
options:
- label: I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/xr/blob/main/CODE_OF_CONDUCT.md)
required: true
- label: Read the [Contributing Guidelines](https://github.com/Tresjs/xr/blob/main/CONTRIBUTING.md).
required: true
- label: Read the [docs](https://tresjs.org/guide).
required: true
- label: Check that there isn't [already an issue](https://github.com/tresjs/xr/issues) that reports the same bug to avoid creating a duplicate.
required: true
- label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: New feature proposal 🪐
description: Propose a new feature to be added to TresJS XR
labels: [enhancement]
body:
- type: markdown
attributes:
value: |
Thanks for your interest in the project and taking the time to fill out this feature report!
- type: textarea
id: feature-description
attributes:
label: Description
description: 'Clear and concise description of the problem. Please make the reason and usecases as detailed as possible. If you intend to submit a PR for this issue, tell us in the description. Thanks!'
placeholder: As a developer using TresJS XR I want [goal / wish] so that [benefit].
validations:
required: true
- type: textarea
id: suggested-solution
attributes:
label: Suggested solution
description: 'In module [xy] we could provide following implementation...'
validations:
required: true
- type: textarea
id: alternative
attributes:
label: Alternative
description: Clear and concise description of any alternative solutions or features you've considered.
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Any other context or screenshots about the feature request here.
- type: checkboxes
id: checkboxes
attributes:
label: Validations
description: Before submitting the issue, please make sure you do the following
options:
- label: I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/xr/blob/main/CODE_OF_CONDUCT.md)
required: true
- label: Read the [Contributing Guidelines](https://github.com/Tresjs/xr/blob/main/CONTRIBUTING.md).
required: true
- label: Read the [docs](https://tresjs.org/guide).
required: true
- label: Check that there isn't [already an issue](https://github.com/tresjs/xr/issues) that reports the same bug to avoid creating a duplicate.
required: true
32 changes: 32 additions & 0 deletions .github/workflows/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# From https://github.com/remirror/template/blob/4f8c5f5629a081217672a8cce1df085510f43913/.github/actions/pnpm/action.yml
name: pnpm installation
description: Install and audit dependencies for pnpm
inputs:
cache: # id of input
description: The location of the pnpm cache
required: true
default: .pnpm-store
version: # id of input
description: The version to use
required: false
default: 6.10.0

runs:
using: composite
steps:
- name: install pnpm
run: npm install pnpm@${{ inputs.version }} -g
shell: bash

- name: setup pnpm config
run: pnpm config set store-dir ${{ inputs.cache }}
shell: bash

- name: install dependencies
run: pnpm install --shamefully-hoist
shell: bash

# Avoid running husky hooks on Github
# http://typicode.github.io/husky/how-to.html
env:
HUSKY: 0
17 changes: 17 additions & 0 deletions .github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run linters
on: [push]

env:
PNPM_CACHE_FOLDER: .pnpm-store
HUSKY: 0 # Bypass husky commit hook for CI

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run Lint
run: pnpm run lint
8 changes: 8 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Skip Husky install in production and CI
// http://typicode.github.io/husky/how-to.html
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0)
}
const husky = (await import('husky')).default
// eslint-disable-next-line no-console
console.log(husky())
25 changes: 25 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# NOTE: Don't fail immediately after error
# This allows us to echo messages even if the linter exits with an error.
set +e

# NOTE: --silent to keep pnpm from echoing, e.g., "> @tresjs/xr[...] lint"
# --max-warnings=0 to fail on errors *and* warnings
pnpm --silent lint --max-warnings=0

# NOTE: Capture linter exit status.
LINT_STATUS=$?

# NOTE: If linting failed, inform user how to proceed.
if [[ $LINT_STATUS != 0 ]]; then
echo "
To fix linter problems:
pnpm lint --fix – fix automatically fixable problems
pnpm lint – print a list of problems to fix by hand

To skip this verification and push anyway (not recommended):
git push --no-verify <...>
"
fi

# NOTE: +e was set, so we have to return an exit status.
exit $LINT_STATUS
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"lint:fix": "eslint . --fix",
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
"docs:preview": "vitepress preview docs",
"prepare": "husky"
},
"peerDependencies": {
"@tresjs/core": ">=3.5.0",
Expand All @@ -72,6 +73,7 @@
"dts": "^0.1.1",
"eslint": "^9.5.0",
"eslint-plugin-vue": "^9.26.0",
"husky": "^9.0.11",
"kolorist": "^1.8.0",
"pathe": "^1.1.2",
"release-it": "^17.4.0",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 05e6e04

Please sign in to comment.