-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/moira-prometheus
- Loading branch information
Showing
12 changed files
with
171 additions
and
41 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,9 @@ | ||
#!/bin/bash | ||
|
||
# Check if any of the specified files are staged for commit | ||
if git diff --name-only --cached | grep -E 'api/'; then | ||
echo "Format swaggo annotations (swag fmt)" | ||
swag fmt | ||
fi | ||
|
||
make lint |
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,27 @@ | ||
name: Delete spec version from SwaggerHub | ||
defaults: | ||
run: | ||
working-directory: . | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release/[0-9]+.[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
removespec: | ||
name: Delete api from SwaggerHub | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.16.0' | ||
- run: npm i --location=global swaggerhub-cli | ||
- run: | | ||
VERSION=`echo ${GITHUB_REF_NAME}| sed 's#[^a-zA-Z0-9_\.\-]#_#g'` | ||
SWAGGERHUB_API_KEY=${{secrets.SWAGGERHUB_TOKEN}} swaggerhub api:unpublish "Moira/moira-alert/${VERSION}" || true | ||
SWAGGERHUB_API_KEY=${{secrets.SWAGGERHUB_TOKEN}} swaggerhub api:delete "Moira/moira-alert/${VERSION}" || true | ||
# The `|| true` at the end of the calls is necessary to keep the job from crashing | ||
# when deleting documentation that hasn't been created yet, but if you see something wrong happening, | ||
# remove `|| true` from the command |
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,60 @@ | ||
name: Publish spec version to SwaggerHub | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- release/[0-9]+.[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
validate-spec: | ||
name: Validate spec file | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
working-directory: . | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: go.sum | ||
- run: make install-swag | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.16.0' | ||
- run: npm install --location=global @openapitools/openapi-generator-cli | ||
- run: make spec | ||
- run: make validate-spec | ||
|
||
- name: Save build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: specfile | ||
path: docs/swagger.yaml | ||
|
||
publishspec: | ||
name: Upload generated OpenAPI description | ||
runs-on: ubuntu-22.04 | ||
needs: validate-spec | ||
defaults: | ||
run: | ||
working-directory: . | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download spec file artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: specfile | ||
path: docs | ||
|
||
- uses: actions/setup-node@v3 | ||
- run: npm i --location=global swaggerhub-cli | ||
- run: | | ||
VERSION=`echo ${GITHUB_REF_NAME}| sed 's#[^a-zA-Z0-9_\.\-]#_#g'` | ||
SWAGGERHUB_API_KEY=${{secrets.SWAGGERHUB_TOKEN}} swaggerhub api:create "Moira/moira-alert/${VERSION}" -f ./docs/swagger.yaml --published=publish --visibility=public |
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,28 @@ | ||
name: Validate OpenAPI on PR | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
mergespec: | ||
name: Validate spec file | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
working-directory: . | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: go.sum | ||
- run: make install-swag | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16.16.0' | ||
- run: npm install --location=global @openapitools/openapi-generator-cli | ||
- run: make spec | ||
- run: make validate-spec |
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
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
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