api
This commit is contained in:
37
frontend/web/api-doc/.github/workflows/dependabot-merge.yml
vendored
Normal file
37
frontend/web/api-doc/.github/workflows/dependabot-merge.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Merge me!
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
branches: [ master, next ]
|
||||
|
||||
jobs:
|
||||
merge-me:
|
||||
name: Merge me!
|
||||
if: github.actor == 'dependabot[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# This first step will fail if there's no metadata and so the approval
|
||||
# will not occur.
|
||||
- name: Dependabot metadata
|
||||
id: dependabot-metadata
|
||||
uses: dependabot/fetch-metadata@v1.1.1
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
# Here the PR gets approved.
|
||||
- name: Approve a PR
|
||||
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
||||
run: gh pr review --approve "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
# Finally, tell dependabot to merge the PR if all checks are successful
|
||||
- name: Instruct dependabot to squash & merge
|
||||
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
||||
uses: mshick/add-pr-comment@v2
|
||||
with:
|
||||
repo-token: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
allow-repeats: true
|
||||
message: |
|
||||
@dependabot squash and merge
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
20
frontend/web/api-doc/.github/workflows/docker-image-check.yml
vendored
Normal file
20
frontend/web/api-doc/.github/workflows/docker-image-check.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Security scan for docker image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '30 4 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
image-ref: 'docker.io/swaggerapi/swagger-ui:unstable'
|
||||
format: 'table'
|
||||
exit-code: '1'
|
||||
ignore-unfixed: true
|
||||
vuln-type: 'os,library'
|
||||
severity: 'CRITICAL,HIGH'
|
83
frontend/web/api-doc/.github/workflows/nodejs.yml
vendored
Normal file
83
frontend/web/api-doc/.github/workflows/nodejs.yml
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, next ]
|
||||
pull_request:
|
||||
branches: [ master, next ]
|
||||
|
||||
env:
|
||||
CYPRESS_CACHE_FOLDER: cypress/cache
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Cache Node Modules and Cypress binary
|
||||
uses: actions/cache@v3
|
||||
id: cache-primes
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
${{ env.CYPRESS_CACHE_FOLDER }}
|
||||
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-primes.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Lint code for errors only
|
||||
run: npm run lint-errors
|
||||
|
||||
- name: Run all tests
|
||||
run: npm run just-test-in-node && npm run test:unit-jest
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Build SwaggerUI
|
||||
run: npm run build
|
||||
|
||||
- name: Test build artifacts
|
||||
run: npm run test:artifact
|
||||
|
||||
e2e-tests:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
containers: ['+(a11y|security|bugs)/**/*.js', 'features/**/+(o|d)*.js', 'features/**/m*.js', 'features/**/!(o|d|m)*.js']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js 16.x
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Cache Node Modules and Cypress binary
|
||||
uses: actions/cache@v3
|
||||
id: cache-primes
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
${{ env.CYPRESS_CACHE_FOLDER }}
|
||||
key: ${{ runner.os }}-node-and-cypress-${{ hashFiles('package-lock.json') }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-primes.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: Cypress Test
|
||||
run: npx start-server-and-test cy:start http://localhost:3204 'npm run cy:run -- --spec "test/e2e-cypress/tests/${{ matrix.containers }}"'
|
79
frontend/web/api-doc/.github/workflows/release-swagger-ui-react.yml
vendored
Normal file
79
frontend/web/api-doc/.github/workflows/release-swagger-ui-react.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
name: Build & Release SwaggerUI-React@next
|
||||
|
||||
# single-stage
|
||||
on:
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- next
|
||||
|
||||
# multi-stage automation
|
||||
# on:
|
||||
# workflow_run:
|
||||
# workflows: ["Release SwaggerUI@next"]
|
||||
# types:
|
||||
# - completed
|
||||
# branches: [next]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: flavors/swagger-ui-react/release
|
||||
jobs:
|
||||
release-swagger-ui-react:
|
||||
name: Release SwaggerUI React
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
ref: next
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Prepare SwaggerUI dist
|
||||
run: |
|
||||
cd ../../../
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
- name: Install dependencies (to create package manifest)
|
||||
run: npm ci
|
||||
|
||||
- name: MKDIR `dist` working directory
|
||||
run: mkdir -p ../dist
|
||||
|
||||
- name: Copy SwaggerUI dist files to MKDIR
|
||||
run: |
|
||||
ls ../dist
|
||||
cp ../../../dist/swagger-ui-es-bundle-core.js ../dist
|
||||
cp ../../../dist/swagger-ui-es-bundle-core.js.map ../dist
|
||||
cp ../../../dist/swagger-ui.css ../dist
|
||||
cp ../../../dist/swagger-ui.css.map ../dist
|
||||
|
||||
- name: Create a releasable package manifest
|
||||
run: node create-manifest.js > ../dist/package.json
|
||||
|
||||
- name: Transpile our top-level React Component
|
||||
run: |
|
||||
../../../node_modules/.bin/cross-env BABEL_ENV=commonjs ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/commonjs.js
|
||||
../../../node_modules/.bin/cross-env BABEL_ENV=es ../../../node_modules/.bin/babel --config-file ../../../babel.config.js ../index.jsx > ../dist/index.js
|
||||
|
||||
- name: Copy our README into the dist folder for npm
|
||||
run: cp ../README.md ../dist
|
||||
|
||||
- name: Copy LICENSE & NOTICE into the dist folder for npm
|
||||
run: |
|
||||
cp ../../../LICENSE ../dist
|
||||
cp ../../../NOTICE ../dist
|
||||
|
||||
- name: Run the release from the dist folder
|
||||
run: |
|
||||
cd ../dist
|
||||
pwd
|
||||
npm pack . --tag alpha
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
73
frontend/web/api-doc/.github/workflows/release-swagger-ui.yml
vendored
Normal file
73
frontend/web/api-doc/.github/workflows/release-swagger-ui.yml
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
name: Release SwaggerUI@next
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- next
|
||||
|
||||
jobs:
|
||||
release-swagger-ui:
|
||||
name: Release SwaggerUI
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
ref: next
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- name: Determine the next release version
|
||||
uses: cycjimmy/semantic-release-action@v3
|
||||
with:
|
||||
dry_run: true
|
||||
extra_plugins: |
|
||||
@semantic-release/git
|
||||
@semantic-release/exec
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Nothing to release
|
||||
if: ${{ env.NEXT_RELEASE_VERSION == '' }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Nothing to release')
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Prepare release
|
||||
run: |
|
||||
npm run build
|
||||
|
||||
- name: Semantic Release
|
||||
id: semantic
|
||||
uses: cycjimmy/semantic-release-action@v3
|
||||
with:
|
||||
dry_run: false
|
||||
extra_plugins: |
|
||||
@semantic-release/git
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SWAGGER_BOT_GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Release failed
|
||||
if: steps.semantic.outputs.new_release_published == 'false'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Release failed')
|
||||
|
||||
- name: Release published
|
||||
run: |
|
||||
echo ${{ steps.semantic.outputs.new_release_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_major_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_minor_version }}
|
||||
echo ${{ steps.semantic.outputs.new_release_patch_version }}
|
Reference in New Issue
Block a user