-
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.
* First parse including tests * add github actions * Remove prepare * unset GITHUB event path so test runs in actions * unset GITHUB event path so test runs in actions * Expand readme * Remove prepare * Prettier * command name change and review fixes * ensure nocks aren't bundled
- Loading branch information
Showing
20 changed files
with
12,244 additions
and
94 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,72 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
env: | ||
CI: true | ||
|
||
jobs: | ||
pullRequestBuild: | ||
name: Pull Request Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Audit Signatures | ||
run: npm audit signatures | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Compile | ||
run: npm run ci:compile | ||
- name: Check Code Style | ||
run: npm run ci:style | ||
- name: Perform Linting | ||
run: npm run ci:lint | ||
- name: Run Tests | ||
run: npm run ci:test | ||
|
||
branchBuild: | ||
runs-on: ubuntu-latest | ||
name: Branch Build | ||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Audit Signatures | ||
run: npm audit signatures | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Compile | ||
run: npm run ci:compile | ||
- name: Check Code Style | ||
run: npm run ci:style | ||
- name: Perform Linting | ||
run: npm run ci:lint | ||
- name: Run Tests | ||
run: npm run ci:test |
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,46 @@ | ||
name: Coverage | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
env: | ||
CI: true | ||
|
||
jobs: | ||
branchBuild: | ||
runs-on: ubuntu-latest | ||
name: Branch Build | ||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm ci --ignore-scripts | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Calculate Code Coverage | ||
run: npm run ci:coverage | ||
- name: Create Coverage Report for base branch | ||
run: | | ||
mv coverage/lcov.info coverage/lcov_head.info | ||
git fetch | ||
git checkout origin/${{ github.event.pull_request.base.ref }} | ||
npm ci --ignore-scripts && npm run ci:coverage | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Post Coverage Report | ||
uses: romeovs/[email protected] | ||
with: | ||
lcov-file: 'coverage/lcov_head.info' | ||
lcov-base: 'coverage/lcov.info' | ||
delete-old-comments: 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,19 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- run: npm publish | ||
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 |
---|---|---|
@@ -1,104 +1,15 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
.idea | ||
.code | ||
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/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
build | ||
node_modules | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# 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 variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# 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 | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
.npmignore |
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 |
---|---|---|
@@ -1,2 +1,31 @@ | ||
# github-actions | ||
|
||
Tools for use with gitub-actions | ||
|
||
## Commands: | ||
|
||
### `npx action is-api` | ||
|
||
Identifies if a project contains a `src/api` folder structure and returns GitHub action compatible output. | ||
|
||
- If TRUE returns `::set-output name=IS_API::true` | ||
- If FALSE returns `::set-output name=IS_API::false` | ||
|
||
### `npx action generate-beta-version` | ||
|
||
Generates a beta version string for the project and updates the package.json to this. | ||
|
||
Reads the current version from the projects.json and appends `-beta.` to it | ||
Then generates a 5 character random string. For example `1.2.3-beta.aBc4d` | ||
|
||
Result is then written to the projects package.json file that is located on the GitHub action container. | ||
|
||
New version is output in the GitHub action compatible output including the Package name `::set-output name=NEW_VERSION::@checkdigit/[email protected]` | ||
|
||
### `npx action publish-comment` | ||
|
||
Writes a comment into the Pull Request that contains the new version and the npm command to install it. | ||
|
||
Expects an environment variable `NEW_PACKAGE_VERSION` set that contains the `NEW_VERSION` output from `npx action generateBetaVersion` | ||
|
||
If any previous comments exist those will be removed so only the most recent beta version is shown on the Pull Request |
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 @@ | ||
#!/usr/bin/env node | ||
require('../dist/index.js'); |
Oops, something went wrong.