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

Lint and actions #4

Merged
merged 4 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Setup
description: Setup Node.js and install dependencies
runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Cache dependencies
id: npm-cache
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-

- name: Install dependencies
run: |
npm ci
shell: bash
28 changes: 28 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and Release

on:
workflow_dispatch:

jobs:
setup:
uses: ./.github/workflows/setup.yml

build-and-release:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://npm.pkg.github.com"
- name: Build
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
25 changes: 25 additions & 0 deletions .github/workflows/ff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Fast-Forward PR

on:
issue_comment:
types: [created]

jobs:
fast_forward_job:
name: Fast Forward
if: github.event.issue.pull_request != '' && (contains(github.event.comment.body, '/yolo'))
runs-on: ubuntu-latest
steps:
- name: Checkout code into workspace directory
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fast Forward PR
id: ff-action
uses: endre-spotlab/fast-forward-js-action@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
success_message: "Success! Fast forwarded ***target_base*** to ***source_head***! ```git checkout target_base && git merge source_head --ff-only``` "
failure_message: "Failed! Cannot do fast forward!"
production_branch: "main"
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
setup:
uses: ./.github/workflows/setup.yml

lint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Lint
run: npm run lint
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
setup:
uses: ./.github/workflows/setup.yml

test:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Run tests
run: npm test
19 changes: 19 additions & 0 deletions .github/workflows/tsc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: TypeScript Check

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
setup:
uses: ./.github/workflows/setup.yml

tsc:
needs: setup
runs-on: ubuntu-latest
steps:
- name: TypeScript Check
run: npx tsc --noEmit
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.16.0
9 changes: 9 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
12 changes: 12 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Loading