-
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.
Merge pull request #2 from Bandwidth/v1.0.0-beta
DX-2726 Initial Development of Linter CLI
- Loading branch information
Showing
16 changed files
with
8,606 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 @@ | ||
# Global rule: | ||
* @Bandwidth/dx |
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,51 @@ | ||
name: Deploy Beta | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy_beta: | ||
name: Deploy Beta | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.release.prerelease }} | ||
steps: | ||
- name: Check Branch Name Format | ||
run: | | ||
re=v[0-9]+.[0-9]+.[0-9]+-beta | ||
if ! [[ ${{ github.event.release.target_commitish }} =~ $re ]]; then | ||
echo 'Target branch does not match expected regex pattern for beta releases (v[0-9]+.[0-9]+.[0-9]+-beta)' | ||
echo '${{ github.event.release.target_commitish }}' | ||
echo 'Please update your branch name to match the expected regex pattern' | ||
exit 1 | ||
fi | ||
- name: Set Release Version | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV | ||
|
||
- name: Check Release Version Format | ||
run: | | ||
re=[0-9]+.[0-9]+.[0-9]+-beta | ||
if ! [[ $RELEASE_VERSION =~ $re ]]; then | ||
echo 'Tag does not match expected regex pattern for beta releases (v[0-9]+.[0-9]+.[0-9]+-beta)' | ||
echo $RELEASE_VERSION | ||
echo 'Please update your tag to match the expected regex pattern' | ||
exit 1 | ||
fi | ||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '12.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Build and Test npm Package | ||
run: | | ||
npm install | ||
npm run build | ||
npm run test | ||
- name: Publish npm Package | ||
run: | | ||
npm version $RELEASE_VERSION --no-git-tag-version | ||
npm publish --tag beta |
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: Deploy | ||
on: | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set Release Version | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '12.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Build and Test npm Package | ||
run: | | ||
npm install | ||
npm run build | ||
npm run test | ||
- name: Publish npm Package | ||
run: | | ||
npm version $RELEASE_VERSION --no-git-tag-version | ||
npm publish |
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,23 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Test | ||
run: | | ||
npm install | ||
npm run 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,10 @@ | ||
# pkg files | ||
node_modules | ||
ruleset.yml | ||
downloaded_ruleset.yml | ||
|
||
# build | ||
build/ | ||
|
||
# VS Code | ||
.vscode |
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 +1,30 @@ | ||
# oas-linter-cli | ||
|
||
This is a CLI tool that enables users to run an OAS (Open API Spec) file through the DevX ruleset before opening a pull request against [api-specs](https://github.com/Bandwidth/api-specs) | ||
|
||
## Setup and Install | ||
|
||
```sh | ||
# if your npm profile isnt setup to download npm packages published to githubs npm registry - run these commands first | ||
npm login --registry https://npm.pkg.github.com # Requires a github token with Bandwidth SSO access | ||
npm config set @Bandwidth:registry https://npm.pkg.github.com | ||
|
||
# note the uppercase `B` | ||
npm install -g @Bandwidth/oas-linter-cli | ||
``` | ||
|
||
## Usage | ||
|
||
```sh | ||
bw-oas-lint -h # Help | ||
bw-oas-lint lint ../path/to/my/spec.yml # must be in Yaml format | ||
|
||
# add -s flag to save the terminal output to a .json file in your home directory | ||
``` | ||
|
||
## Uninstall | ||
|
||
```sh | ||
# note the lowercase `b` | ||
npm uninstall -g @bandwidth/oas-linter-cli | ||
``` |
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 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
moduleNameMapper: { | ||
"^commands/(.*)$": "<rootDir>/build/commands/$1", | ||
"^static/(.*)$": "<rootDir>/build/static/$1", | ||
"^tests/fixtures/(.*)$": "<rootDir>/tests/fixtures/$1" | ||
} | ||
}; |
Oops, something went wrong.