git.iko.soy/typeable/compaREST
on master help sign in
Preparing for 0.1.0.0 release (#129)

* MAde project name optional * Refined readme * Documented the release procedure * Updated versions * Refined the readme some more

commit5e2eff7f427a661a9346c37bb9e4fcec31e4a232 authoriko <ilyakooo0@gmail.com> dateThu 3 Feb 2022, 16:07 (5 years ago) parentdb716ee
11 files changed+78−35
CHANGELOG.md+2−2 LICENSE+1−1 README.md+41−18 action.yaml+9−8 compaREST.cabal+1−1 docs/Releasing.md+15 docs/img/pre-release-artifacts.png docs/img/pre-release-ci.png docs/img/pre-release.png github-action/CompaREST/GitHub/API.hs+2−2 github-action/CompaREST/GitHub/Action/Config.hs+7−3
CHANGELOG.md+2−2
@@ -2,8 +2,8 @@
22
33`comparest` uses [PVP Versioning][1].
44
5−## 0.0.0.0
5+## 0.1.0.0
66
7−* Initially created.
7+* Initial release.
88
99[1]: https://pvp.haskell.org
LICENSE+1−1
@@ -1,6 +1,6 @@
11MIT License
22
3−Copyright (c) 2021 Aleksey Uymanov
3+Copyright (c) 2021 Typeable
44
55Permission is hereby granted, free of charge, to any person obtaining a copy
66of this software and associated documentation files (the "Software"), to deal
README.md+41−18
@@ -1,14 +1,35 @@
1−# CompaREST
1+# compaREST
22
3−[![Hackage](https://img.shields.io/hackage/v/comparest.svg?logo=haskell)](https://hackage.haskell.org/package/comparest)
4−[![Stackage Lts](http://stackage.org/package/comparest/badge/lts)](http://stackage.org/lts/package/comparest)
3+[![Hackage](https://img.shields.io/hackage/v/compaREST.svg?logo=haskell)](https://hackage.haskell.org/package/comparest)
4+[![Stackage Lts](http://stackage.org/package/compaREST/badge/lts)](http://stackage.org/lts/package/comparest)
55[![Stackage Nightly](http://stackage.org/package/comparest/badge/nightly)](http://stackage.org/nightly/package/comparest)
66[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
77
88Compatibility checker for OpenAPI
9−# Quick Start Guide
109
11−## Your situation
10+## Using compaREST in Github Actions
11+
12+Add the following step to your Github Actions workflow:
13+
14+```yaml
15+- uses: typeable/comparest
16+ if: ${{ github.event_name == 'pull_request' }}
17+ with:
18+ old: old-openapi.yaml
19+ new: new-openapi.yaml
20+```
21+
22+The `new` and `old` values should be paths to your OpenAPI specifications you want to compare.
23+
24+You will get something like this in your pull requests:
25+
26+![](docs/img/github-action-report.png)
27+
28+For more detail please see our [integration guide](docs/Integration_guide.md).
29+
30+## An example
31+
32+### Your situation
1233
1334You are developing a very important server with a REST API. You have clients who use your API that you do not control. Say, you are also developing a mobile app that uses your API and you can't force someone to update to the latest version. (Or you prefer not to for UX reasons.)
1435
@@ -75,7 +96,7 @@ components:
7596 $ref: "#/components/schemas/Pet"
7697```
7798
78−## Evolving your product
99+### Evolving your product
79100
80101Enthused over your initial success you hurry to release a new and improved version of your API and mobile app.
81102
@@ -144,7 +165,7 @@ components:
144165
145166Looking at the very large and complex API description, you grow more and more concerned that your old mobile app might stop working when you update the server. But the spec is too large and too complex to reasonably assess this manually.
146167
147−## Assessing compatibility automatically
168+### Assessing compatibility automatically
148169
149170Luckily, you have access to compaREST which can programmatically analyze your APIs and determine what, if anything, breaks compatibility and what doesn't.
150171
@@ -158,15 +179,15 @@ Running this command will output a file `report.md`, containing the compatibilit
158179
159180> # Summary
160181>
161−> | [⚠️ Breaking changes](#breaking-changes) | [🙆 Non-breaking changes](#non-breaking-changes) | 🤷 Unsupported feature changes |
162−> |------------------------------------------|-------------------------------------------------|-------------------------------|
163−> | 5 | 6 | 0 |
182+> | [❌ Breaking changes](#breaking-changes) | [⚠️ Non-breaking changes](#non-breaking-changes) |
183+> |------------------------------------------|--------------------------------------------------|
184+> | 5 | 6 |
164185>
165−> # <span id="breaking-changes"></span>⚠️ Breaking changes
186+> # <span id="breaking-changes"></span>❌ Breaking changes
166187>
167188> ## **GET** /pets
168189>
169−> ### 📱⬅️ JSON Response – 200
190+> ### ⬅️☁️ JSON Response – 200
170191>
171192> #### `$[*].name(String)`
172193>
@@ -176,7 +197,7 @@ Running this command will output a file `report.md`, containing the compatibilit
176197>
177198> ## **POST** /pets
178199>
179−> ### 📱➡️ JSON Request
200+> ### ➡️☁️ JSON Request
180201>
181202> #### `$.weight`
182203>
@@ -191,7 +212,7 @@ Running this command will output a file `report.md`, containing the compatibilit
191212>
192213> Value is now a multiple of 1.0.
193214>
194−> # <span id="non-breaking-changes"></span>🙆 Non-breaking changes
215+> # <span id="non-breaking-changes"></span>⚠️ Non-breaking changes
195216>
196217> ## **GET** /pets
197218>
@@ -203,7 +224,7 @@ Running this command will output a file `report.md`, containing the compatibilit
203224>
204225> Upper bound changed from 20.0 inclusive to 30.0 inclusive.
205226>
206−> ### 📱⬅️ JSON Response – 200
227+> ### ⬅️☁️ JSON Response – 200
207228>
208229> #### `$[*].weight`
209230>
@@ -220,7 +241,7 @@ Running this command will output a file `report.md`, containing the compatibilit
220241>
221242> ## **POST** /pets
222243>
223−> ### 📱➡️ JSON Request
244+> ### ➡️☁️ JSON Request
224245>
225246> #### `$.name(String)`
226247>
@@ -230,7 +251,7 @@ Running this command will output a file `report.md`, containing the compatibilit
230251
231252You now know exactly in what situations and in what way your 1.0 version of the app will break if you deploy your 1.1 version of the server.
232253
233−## Additional formats
254+### Additional formats
234255
235256You can also produce a self-contained HTML report that you can open in your browser by simply omitting the file extension of the output file:
236257
@@ -238,7 +259,9 @@ You can also produce a self-contained HTML report that you can open in your brow
238259docker run --rm -v $(pwd):/data:rw typeable/comparest --client /data/api-1.0.0.yaml --server /data/api-1.1.0.yaml --output /data/report
239260```
240261
241−# CLI docs
262+## CLI docs
263+
264+For more detail please see our [user guide](docs/User_guide.md).
242265
243266```
244267Usage: comparest (-c|--client ARG) (-s|--server ARG)
action.yaml+9−8
@@ -7,21 +7,22 @@ inputs:
77 default: "${{ github.token }}"
88 required: false
99 repo:
10− description: The owner of the repo in which to post the comment.
10+ description: The owner of the repo in which to post the results.
1111 default: "${{ github.repository }}"
1212 required: false
1313 project_name:
14− description: The name of the project to which the API pertains.
15− required: true
14+ description: The name of the project to which the API pertains. Used to name the check. Useful when you have multiple APIs in the same repo.
15+ required: false
16+ default: ""
1617 footer:
17− description: A footer that can be appended to the comment.
18+ description: A footer that can be appended to the check body.
1819 required: false
1920 default: ""
2021 old:
21− description: The path to old specification of the API.
22+ description: The path to the old (client) specification of the API.
2223 required: true
2324 new:
24− description: The path to new specification of the API.
25+ description: The path to new (server) specification of the API.
2526 required: true
2627 sha:
2728 description: The sha of the commit to post the check for.
@@ -29,7 +30,7 @@ inputs:
2930 default: "${{ github.event.pull_request.head.sha }}"
3031runs:
3132 using: "docker"
32− image: "docker://typeable/comparest-github-action:latest"
33+ image: "docker://typeable/comparest-github-action:0.1.0.0"
3334 env:
3435 GITHUB_TOKEN: "${{ inputs.GITHUB_TOKEN }}"
3536 REPO: "${{ inputs.repo }}"
@@ -44,4 +45,4 @@ runs:
4445
4546branding:
4647 icon: crosshair
47− color: gray-dark
48+ color: blue
compaREST.cabal+1−1
@@ -1,6 +1,6 @@
11cabal-version: 2.4
22name: compaREST
3−version: 0.0.0.0
3+version: 0.1.0.0
44synopsis: Compatibility checker for OpenAPI
55description: Compatibility checker for OpenAPI.
66license: MIT
docs/Releasing.mdnew file+15
@@ -0,0 +1,15 @@
1+# The release procedure
2+
3+1. Update the version number everywhere:
4+ 1. Version in [compaREST.cabal](../compaREST.cabal)
5+ 2. Docker tag in [action.yaml](../action.yaml)
6+ 3. Set the version of unreleased changes in [CHANGELOG.md](../CHANGELOG.md)
7+2. Publish!
8+ 1. Create a pre-release on GitHub:
9+ ![](img/pre-release.png)
10+ 2. This will automatically start the release procedure. You can check the state of it in the "Actions" tab on GitHub:
11+ ![](img/pre-release-ci.png)
12+ 3. If everything goes as planned, the release action should pass and all assets should be added to the release:
13+ ![](img/pre-release-artifacts.png)
14+ 4. The new version should be automatically uploaded a release candidate to [Hackage](https://hackage.haskell.org/package/compaREST/candidates/). Make sure everything looks okay and publish it.
15+ 5. Go to the Releases tab on GitHub and edit the release to make it not a "pre-release".
docs/img/pre-release-artifacts.pngnew file

Binary file not shown.

docs/img/pre-release-ci.pngnew file

Binary file not shown.

docs/img/pre-release.pngnew file

Binary file not shown.

github-action/CompaREST/GitHub/API.hs+2−2
@@ -29,7 +29,7 @@ postStatusProcessing = do
2929 repoOwner
3030 repoName
3131 Check
32− { checkName = mkName Proxy $ "compaREST – " <> projectName
32+ { checkName = mkName Proxy checkName
3333 , checkSha = sha
3434 , checkDetailsURL = Nothing
3535 , checkExternalId = Nothing
@@ -60,7 +60,7 @@ postStatus x = do
6060 repoOwner
6161 repoName
6262 Check
63− { checkName = mkName Proxy $ "compaREST – " <> projectName
63+ { checkName = mkName Proxy checkName
6464 , checkSha = sha
6565 , checkDetailsURL = Nothing
6666 , checkExternalId = Nothing
github-action/CompaREST/GitHub/Action/Config.hs+7−3
@@ -8,13 +8,14 @@ import Data.Text (Text)
88import qualified Data.Text as T
99import qualified GitHub as GH
1010
11+import Data.Functor
1112import System.Envy
1213
1314data Config = Config
1415 { githubToken :: GH.Auth
1516 , repoOwner :: GH.Name GH.Owner
1617 , repoName :: GH.Name GH.Repo
17− , projectName :: Text
18+ , checkName :: Text
1819 , footerText :: Text
1920 , root :: FilePath
2021 , sha :: GH.Name GH.Commit
@@ -27,7 +28,10 @@ instance FromEnv Config where
2728 T.split (== '/') <$> env "REPO" >>= \case
2829 [owner, name] -> pure (owner, name)
2930 _ -> fail "malformed repo"
30− projectName <- env "PROJECT_NAME"
31+ checkName <-
32+ envMaybe "PROJECT_NAME" <&> \case
33+ Just pName | not . T.null . T.strip $ pName -> "compaREST – " <> pName
34+ _ -> "compaREST"
3135 footerText <- env "FOOTER"
3236 root <- envMaybe "ROOT" .!= "."
3337 sha <- env "SHA"
@@ -36,7 +40,7 @@ instance FromEnv Config where
3640 { githubToken = token
3741 , repoOwner = GH.mkName Proxy owner
3842 , repoName = GH.mkName Proxy repo
39− , projectName = projectName
43+ , checkName = checkName
4044 , footerText = footerText
4145 , root = root
4246 , sha = GH.mkName Proxy sha