-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adds API spec coverage report. #179
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b8e161b
Added API spec coverage.
dblock de1fe44
Use dblock/opensearch-api.
dblock e6a31b2
Use released version of OpenSearch 2.12.
dblock 60f5d32
Report coverage percentage.
dblock 1bc3e98
Commit a Dockerfile, simplify coverage workflow.
dblock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,42 @@ | ||
name: API Coverage | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
JAVA_VERSION: 11 | ||
OPENSEARCH_INITIAL_ADMIN_PASSWORD: BobgG7YrtsdKf9M | ||
|
||
jobs: | ||
coverage: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
- name: Build and Run Docker Container | ||
run: | | ||
docker build coverage --tag opensearch-with-api-plugin | ||
docker run -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e OPENSEARCH_INITIAL_ADMIN_PASSWORD="$OPENSEARCH_INITIAL_ADMIN_PASSWORD" opensearch-with-api-plugin | ||
sleep 15 | ||
- name: Display OpenSearch Info | ||
run: | | ||
curl -ks -u "admin:$OPENSEARCH_INITIAL_ADMIN_PASSWORD" https://localhost:9200/ | jq | ||
- name: Dump and Compare API | ||
run: | | ||
curl -ks -u "admin:$OPENSEARCH_INITIAL_ADMIN_PASSWORD" https://localhost:9200/_plugins/api | jq > OpenSearch.auto.openapi.json | ||
docker run --rm --mount type=bind,source=.,target=/specs openapitools/openapi-diff:latest /specs/OpenSearch.openapi.json /specs/OpenSearch.auto.openapi.json --json /specs/diff.json | ||
- name: Show Diff | ||
run: | | ||
echo "-------- Missing APIs" | ||
jq -r '.newEndpoints | group_by(.pathUrl)[] | "\(.[0].pathUrl): \([.[].method])"' diff.json | ||
echo "-------- Legacy APIs" | ||
jq -r '.missingEndpoints | group_by(.pathUrl)[] | "\(.[0].pathUrl): \([.[].method])"' diff.json | ||
- name: Gather Coverage | ||
id: coverage | ||
shell: bash | ||
run: | | ||
current=`jq -r '.paths | keys | length' OpenSearch.openapi.json` | ||
total=`jq -r '.paths | keys | length' OpenSearch.auto.openapi.json` | ||
percent=$((current * 100 / total)) | ||
echo "API specs implemented for $current/$total ($percent%) APIs." |
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,7 @@ | ||
ARG OPENSEARCH_VERSION=2.12.0 | ||
FROM opensearchproject/opensearch:${OPENSEARCH_VERSION} | ||
ARG OPENSEARCH_VERSION | ||
RUN /usr/share/opensearch/bin/opensearch-plugin \ | ||
install \ | ||
--batch \ | ||
https://github.com/dblock/opensearch-api/releases/download/v${OPENSEARCH_VERSION}/opensearch-api-${OPENSEARCH_VERSION}.0.zip |
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,7 @@ | ||
### API Coverage | ||
|
||
Uses the [opensearch-api plugin](https://github.com/dblock/opensearch-api), and [openapi-diff](https://github.com/OpenAPITools/openapi-diff) to show the difference between OpenSearch APIs, and the [OpenAPI spec checked into this repo](../OpenSearch.openapi.json). | ||
|
||
API coverage is run on all pull requests via the [coverage workflow](../.github/workflows/coverage.yml). | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sleep feels prone to causing spurious errors, but probably good enough for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a better way to wait for service I can change it.