-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
7,832 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# This is the composite action: | ||
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action | ||
# | ||
# Composite actions have some limitations: | ||
# - many contexts are unavailable, e.g. `runner` | ||
# - `env` can be specified per-step only | ||
# - if `run` is used, `shell` must be explicitly specified | ||
name: 'Setup Node and install dependencies' | ||
description: 'Setup Node and install dependencies using cache' | ||
inputs: | ||
node-version: | ||
description: 'Node version' | ||
required: true | ||
os: | ||
description: 'Composite actions do not support `runner.os`, so it must be passed in as an input' | ||
required: true | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Calculate `CACHE_KEY` | ||
shell: bash | ||
run: | | ||
echo 'CACHE_KEY=node_modules-${{ | ||
inputs.os | ||
}}-${{ | ||
inputs.node-version | ||
}}-${{ | ||
hashFiles('package-lock.json', 'package.json') | ||
}}' >> "$GITHUB_ENV" | ||
- name: Restore `node_modules` | ||
id: node-modules-restore | ||
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: node_modules | ||
key: ${{ env.CACHE_KEY }} | ||
enableCrossOsArchive: true | ||
|
||
- name: Calculate `CACHE_HIT` | ||
shell: bash | ||
run: | | ||
echo 'CACHE_HIT=${{ | ||
(steps.node-modules-restore.outputs.cache-hit == 'true') && 'true' || '' | ||
}}' >> "$GITHUB_ENV" | ||
- name: Setup Node | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
node-version: ${{ inputs.node-version }} | ||
cache: ${{ env.CACHE_HIT != 'true' && 'npm' || '' }} | ||
|
||
- name: Install dependencies | ||
if: env.CACHE_HIT != 'true' | ||
run: npm ci --no-audit --no-fund --progress=false | ||
shell: bash | ||
|
||
- name: Write `node_modules` cache | ||
if: env.CACHE_HIT != 'true' | ||
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: node_modules | ||
key: ${{ env.CACHE_KEY }} | ||
enableCrossOsArchive: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
env: | ||
NODE_VERSION: 18 | ||
|
||
permissions: | ||
id-token: write | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Setup Node and install dependencies | ||
uses: ./.github/actions/setup-node | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
os: ${{ runner.os }} | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
- name: Publish | ||
run: npm publish --verbose --provenance --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
branches: | ||
- main | ||
|
||
env: | ||
NODE_VERSION: 18 | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
name: test-${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Setup Node and install dependencies | ||
uses: ./.github/actions/setup-node | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
os: ${{ runner.os }} | ||
|
||
- name: Test | ||
run: npm test | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,3 +128,5 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* | ||
!/dist/ | ||
!/package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
loglevel=silent | ||
save-exact=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @ts-check | ||
|
||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommended, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
coverageDirectory: './.coverage/', | ||
coverageThreshold: { | ||
'./src/manager': { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.