-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve linting and check for compile errors (#292)
* Improve linting and for compile errors * Check compiled.json is updated * Avoid duplicating runs by using only push trigger * Change to go build
- Loading branch information
Showing
5 changed files
with
77 additions
and
16 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
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
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,13 +1,64 @@ | ||
name: Lint | ||
on: [push, pull_request] | ||
name: Lint | ||
on: [push] | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '10.x' | ||
node-version: "18" | ||
- run: npm install | ||
- run: npm run lint | ||
|
||
compare-output: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: "18" | ||
- run: npm install | ||
- run: npx swagger-cli bundle -t json -w 300 main.yaml > doc/compiled_new.json | ||
- run: diff doc/compiled.json doc/compiled_new.json | ||
|
||
compile-go: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.19.6 | ||
- name: Build | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npm install | ||
npm run generate.go | ||
cd clients/go && go build | ||
compile-cli: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.19.6 | ||
- name: Build | ||
env: | ||
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npm install | ||
npm run generate.cli | ||
cd clients/cli && go build |
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
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 @@ | ||
#!/bin/bash | ||
|
||
output=$(npx openapi-generator-cli validate -i tmp/compiled.yaml | grep -v "inheritance without use of 'discriminator.propertyName'" | grep -v "No validation issues detected.") | ||
if echo "$output" | grep -q -E "WARN|ERROR"; then | ||
echo "$output" | ||
echo "Validation errors" | ||
exit 1 | ||
else | ||
echo "No validation errors" | ||
fi |