forked from learnenough/rails_tutorial_sample_app_7th_ed
59 lines (48 loc) · 1.68 KB
/
openapi-compare.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Compare Runtime API with Latest Published Copy
on:
push:
branches:
- smartbear-api-comparison
env:
DISABLE_SPRING: 'true'
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
jobs:
compare-openapi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: "16"
- name: Install SmartBear CLI
run: npm i -g swaggerhub-cli
- name: Prepare bundle for AppMap installation
run: bundle config unset deployment
- name: Install AppMap tools
uses: getappmap/install-action@v1
with:
project-type: bundler
- name: Rails test setup
run: ./bin/rails db:migrate
- name: Run tests
run: ./bin/rails test
- name: Set API Version Number
if: always()
run: echo "OPENAPI_VERSION"=$(cat openapi-version) >> "$GITHUB_ENV"
- name: Generate OpenAPI with AppMap
if: always()
run: appmap openapi --output-file openapi.yml --openapi-title rails_tutorial_sample_app_7th_ed --openapi-version ${OPENAPI_VERSION}
- name: Get Latest Default
if: always()
run: swaggerhub api:get AppMap/rails_tutorial_sample_app_7th_ed > swaggerhub-api.yml
- name: Remove Blank Lines
if: always()
run: cat openapi.yml | sed '/^$/d' > openapi-clean.yml && cat swaggerhub-api.yml | sed '/^$/d' > swaggerhub-clean.yml
- name: Compare Actual vs SwaggerHub
if: always()
run: diff openapi-clean.yml swaggerhub-clean.yml