Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
santi100a committed Jul 27, 2023
0 parents commit aed62b5
Show file tree
Hide file tree
Showing 32 changed files with 4,845 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest"
},
"plugins": [
"@typescript-eslint",
"eslint-plugin-jest"
],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"no-console": "warn"
}
}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: santi100a
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: npm # See documentation for possible values
directory: / # Location of package manifests
schedule:
interval: weekly
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'CI failed': '**/*.*'
19 changes: 19 additions & 0 deletions .github/workflows/check-md-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check for broken Markdown links

on:
schedule:
- cron: 0 0 * * *
workflow_dispatch: {}

jobs:
check-links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19.x
- name: Install dependencies
run: yarn
- name: Run link check
run: yarn check-links
130 changes: 130 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Continuous Integration (CI)

on:
push:
branches:
- main
paths:
- src/**/*.*

jobs:
test:
outputs:
rel: ${{ steps.commit.outputs.rel }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19.x
always-auth: true

- name: Check commit message
id: commit
run: |
COMMIT_MSG=$(/usr/bin/git log --format=%B -n 1 HEAD)
STRING=$(echo $COMMIT_MSG | (grep -E "infra:|docs:|lint:|code-style:" || echo ''))
if [ -z "$STRING" ]; then
echo "rel=1" >> $GITHUB_OUTPUT
echo "IS_RELEASE_COMMIT=1" >> $GITHUB_ENV
else
echo "This commit will NOT trigger a release."
echo "rel=0" >> $GITHUB_OUTPUT
echo "IS_RELEASE_COMMIT=0" >> $GITHUB_ENV
fi
- name: Install dependencies
run: yarn

- name: Validate Markdown links
run: yarn check-links

- name: Validate package.json
run: yarn validate-package-json

- name: Run ESLint
run: yarn lint

- name: Build source code
run: yarn build

- name: Run test suites
run: yarn test
release:
needs: test
if: needs.test.outputs.rel == 1 || needs.test.outputs.rel == '1'
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Generate tag, release name, and body
run: |
TAG_NAME="v$(jq -r '.version' package.json)"
RELEASE_NAME="Release $TAG_NAME"
BODY=$(sed -n "/## Version $(jq -r '.version' package.json | sed 's/\./\\\./g')/,/##/p" CHANGELOG.md | sed '1d;/^##/d')
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
echo "$BODY" >> release.md
- name: Create release
uses: ncipollo/release-action@v1.12.0
with:
allowUpdates: true
tag: ${{ env.TAG_NAME }}
name: ${{ env.RELEASE_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
bodyFile: release.md
draft: false
prerelease: false
publish-npm:
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 19.x
always-auth: true
- name: Install dependencies
run: yarn
- name: Build code
run: yarn build
- name: Set authentication token
run: |
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_AUTH_TOKEN }}
- name: Publish to NPM
run: yarn publish --access public
publish-gpr:
needs: release
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 19.x
always-auth: true
- name: Install dependencies
run: yarn
- name: Build code
run: yarn build

- name: Set authentication token
run: |
npm set //npm.pkg.github.com/:_authToken ${{ secrets.GPR_AUTH_TOKEN }}
- name: Get ready to publish to GPR
run: |
jq ".name = \"@$REPO\"" package.json > temp.json && mv temp.json package.json
env:
REPO: ${{ github.repository }}
- name: Publish to GPR
run: yarn publish --access public --registry https://npm.pkg.github.com/
21 changes: 21 additions & 0 deletions .github/workflows/issue-welcome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Welcome message for issues
on:
issues:
types:
- opened
permissions:
issues: write
jobs:
welcome-author:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Say hi
uses: jungwinter/comment@v1
with:
type: create
token: ${{ secrets.GITHUB_TOKEN }}
issue_number: ${{ github.event.issue.number }}
body: |
Hi, ${{ github.actor }}!
Make sure to comply with the [Code of Conduct](https://github.com/${{ github.repository }}/blob/main/CODE_OF_CONDUCT.md), [security policy](https://github.com/${{ github.repository }}/blob/main/SECURITY.md) and [contribution guidelines](https://github.com/${{ github.repository }}/blob/main/CONTRIBUTING.md) before contributing to this repo.
31 changes: 31 additions & 0 deletions .github/workflows/pr-build-failed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Report PR build failed
on:
workflow_call:
inputs:
number:
required: true
type: number
pr-author:
required: true
type: string
jobs:
report-pr-build-failed:
continue-on-error: true
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Report the build failed
uses: jungwinter/comment@v1
with:
type: create
token: ${{ secrets.GITHUB_TOKEN }}
issue_number: ${{ inputs.number }}
body: |
Hi, @${{ inputs.pr-author }}! I'm afraid the CI check for PR #${{ inputs.number }} has failed!
Don't worry, it'll run again if you commit any changes to this PR.
- name: Label PR as "CI failed"
uses: actions/labeler@v4
with:
sync-label: true
repo-token: ${{ secrets.GITHUB_TOKEN }}
105 changes: 105 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Pull Request check

on:
pull_request:
types:
- edited
- opened
- synchronize
jobs:
say-hi:
continue-on-error: true
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Say hi
uses: jungwinter/comment@v1
with:
type: create
token: ${{ secrets.GITHUB_TOKEN }}
issue_number: ${{ github.event.pull_request.number }}
body: |
Hi, ${{ github.actor }}!
Make sure to comply with the [Code of Conduct](https://github.com/${{ github.repository }}/blob/main/CODE_OF_CONDUCT.md), [security policy](https://github.com/${{ github.repository }}/blob/main/SECURITY.md) and [contribution guidelines](https://github.com/${{ github.repository }}/blob/main/CONTRIBUTING.md) before contributing to this repo.
test:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install dependencies
run: yarn

- name: Validate package.json
run: yarn validate-package-json

- name: Validate Markdown links
run: yarn check-links

- name: Run ESLint
run: yarn lint

- name: Build code
run: yarn build

- name: Run main test suites
run: yarn test

- name: Report build failed (if any)
if: failure()
uses: ./.github/workflows/pr-build-failed.yml
with:
pr-author: ${{ github.event.pull_request.user.login }}
number: ${{ github.event.pull_request.number }}
assign-and-ping:
runs-on: ubuntu-latest
needs: test
steps:
- name: Check CI status
id: ci-check
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data } = await github.checks.listForRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.payload.pull_request.head.sha,
});
const latestCheck = data.check_runs[0];
return latestCheck.conclusion === 'success';
- name: Assign pull request to yourself
if: steps.ci-check.outputs.result == 'true'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const assignResponse = await github.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
assignees: [context.actor],
});
- name: Request code review
if: steps.ci-check.outputs.result == 'true'
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const requestReviewResponse = await github.pulls.createReviewRequest({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
reviewers: [context.actor],
});
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
*.exe
ignore-*.*
*.log
coverage
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"bracketSameLine": true,
"semi": true,
"singleQuote": true,
"useTabs": true
}
6 changes: 6 additions & 0 deletions .remarkrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"plugins": [
"gfm",
"validate-links"
]
}
Loading

0 comments on commit aed62b5

Please sign in to comment.