Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add github jobs for swaggerhub #895

Merged
merged 78 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
4562ba9
add automatic build swagger documentation and write it for some handler
almostinf Aug 5, 2023
a07207f
add docs for createNewContact function
almostinf Aug 6, 2023
a31b593
fix docs for createNewContact in error
almostinf Aug 6, 2023
5a2c2a4
update github job
almostinf Aug 6, 2023
ea7208c
add documentation for updateContact
almostinf Aug 6, 2023
80ced28
update swag job
almostinf Aug 6, 2023
1b8a824
use make swag command
almostinf Aug 6, 2023
b20d690
fix url in swag handler and update contact docs
almostinf Aug 6, 2023
820918d
fixed annotations for config and contact handlers
almostinf Aug 10, 2023
f9ea66b
swag fmt and removed unused structures
almostinf Aug 10, 2023
06c3659
add specific version in install swag
almostinf Aug 10, 2023
e6b4e0f
add annotations for event and health
almostinf Aug 10, 2023
d7433fc
swag fmt
almostinf Aug 10, 2023
48bc53d
fix linter
almostinf Aug 10, 2023
2dc3248
add annotations for notification handler
almostinf Aug 10, 2023
020b747
added annotations for pattern and subscription
almostinf Aug 11, 2023
12b46b4
updated annotations for pattern and subscription
almostinf Aug 11, 2023
5148f46
add annotations for tag, team contact and team subscription
almostinf Aug 11, 2023
60bda9c
add annotations for team
almostinf Aug 11, 2023
e92c1ca
add some annotations for trigger handler
almostinf Aug 13, 2023
1591d61
fixed triggers annotations
almostinf Aug 13, 2023
44b8e49
updated trigger annotation
almostinf Aug 14, 2023
90353a3
add new annotations for trigger
almostinf Aug 14, 2023
635c811
add annotations for user and fix teams route in subscription handler
almostinf Aug 14, 2023
89861d2
add x-webauth-user token to needed handlers
almostinf Aug 14, 2023
3c81feb
brought the swagger annotations to a uniform form and replaced x-exam…
almostinf Aug 14, 2023
c99db2c
fixed linter errors
almostinf Aug 14, 2023
cc580ff
fixed little error in spec
almostinf Aug 14, 2023
ca9008f
fixed linter
almostinf Aug 14, 2023
2821843
swag fmt and fix linter
almostinf Aug 14, 2023
04eef99
fixed spec command in Makefile
almostinf Aug 15, 2023
b38f977
Merge branch 'feature/add-automatic-swagger-build' into feature/add-g…
almostinf Aug 15, 2023
85df7a5
add github jobs for swaggerhub
almostinf Aug 15, 2023
d9d9d9d
add github jobs for swaggerhub
almostinf Aug 15, 2023
c85a300
fixed publish and delete jobs
almostinf Aug 15, 2023
f0be5d0
fixed github jobs
almostinf Aug 15, 2023
896a3b0
removed version
almostinf Aug 15, 2023
1fc7af8
remove space
almostinf Aug 15, 2023
008f0ad
add automatic finding needed version
almostinf Aug 15, 2023
079ed86
add check logs
almostinf Aug 15, 2023
8c84f38
added swaggerhub api key before command
almostinf Aug 15, 2023
5bc4cdd
add check if doc exist
almostinf Aug 15, 2023
7fc2b17
add check if doc exist
almostinf Aug 15, 2023
23e5a2a
fixed delete job
almostinf Aug 15, 2023
152d5f2
fixed delete job
almostinf Aug 15, 2023
2f74128
trying to get another branch
almostinf Aug 15, 2023
09550d4
add crutch
almostinf Aug 15, 2023
50a3e77
test new feature
almostinf Aug 15, 2023
78941e2
removed check
almostinf Aug 15, 2023
fbb9559
merge with master
almostinf Aug 16, 2023
197aae6
updated docs
almostinf Aug 16, 2023
6f75c8f
merge with feature/add-automatic-swagger-build and fixed delete and p…
almostinf Aug 16, 2023
596768a
returned back blank line in docker feature job
almostinf Aug 16, 2023
ede5f3e
fixed validate swagger doc job
almostinf Aug 16, 2023
e3aac36
rename job
almostinf Aug 16, 2023
14906a0
update swagger doc
almostinf Aug 16, 2023
2bf1a85
Merge branch 'feature/add-automatic-swagger-build' into feature/add-g…
almostinf Aug 16, 2023
180ecd6
update documentation
almostinf Aug 16, 2023
d2d74be
Merge branch 'feature/add-automatic-swagger-build' into feature/add-g…
almostinf Aug 16, 2023
c4e21f5
merge with master and update github jobs
almostinf Aug 17, 2023
f612d44
update jobs
almostinf Aug 17, 2023
704a658
fix publish job
almostinf Aug 17, 2023
b740925
removed feature branch in publish job
almostinf Aug 17, 2023
1036d58
trying to fix delete job
almostinf Aug 17, 2023
7cb5eaf
returned previous edit in delete job
almostinf Aug 17, 2023
1921578
removed feature branch in delete job
almostinf Aug 17, 2023
2f30e91
removed 2 endpoint's annotations
almostinf Aug 17, 2023
bd8784a
trying new jobs
almostinf Aug 21, 2023
81a581c
returned previous doc of get contact
almostinf Aug 21, 2023
3d6db9e
trying to fix delete script
almostinf Aug 21, 2023
2cec281
test publish and delete jobs
almostinf Aug 21, 2023
f6a84a7
test publish and delete jobs
almostinf Aug 21, 2023
4d37de6
returned previous get contact doc
almostinf Aug 21, 2023
55a2285
update jobs and test it
almostinf Aug 21, 2023
df3928b
returned old event doc
almostinf Aug 21, 2023
ac4ad74
update jobs
almostinf Aug 21, 2023
8250a45
update delete and publish jobs
almostinf Aug 22, 2023
8be1946
removed unused comments
almostinf Aug 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/swagger-delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Delete spec version from SwaggerHub
defaults:
run:
working-directory: .
on:
pull_request:
types: [closed]
branches:
- master
push:
branches:
- release/[0-9]+.[0-9]+.[0-9]+
- master

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
60 changes: 60 additions & 0 deletions .github/workflows/swagger-publish.yml
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
28 changes: 28 additions & 0 deletions .github/workflows/swagger-validate.yml
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
Loading