-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split coverage checklist into its own workflow. (#698)
Signed-off-by: dblock <[email protected]>
- Loading branch information
Showing
3 changed files
with
79 additions
and
13 deletions.
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
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,73 @@ | ||
name: Analyze Spec Coverage | ||
|
||
on: | ||
push: | ||
paths: | ||
- .github/workflows/coverage.yml | ||
- package*.json | ||
- spec/** | ||
- tsconfig.json | ||
pull_request: | ||
paths: | ||
- .github/workflows/coverage.yml | ||
- package*.json | ||
- spec/** | ||
- tsconfig.json | ||
|
||
jobs: | ||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Dump OpenSearch Cluster's API | ||
shell: bash -eo pipefail {0} | ||
run: | | ||
docker build coverage --tag opensearch-with-api-plugin | ||
docker run \ | ||
--name opensearch \ | ||
--rm -d \ | ||
-p 9200:9200 -p 9600:9600 \ | ||
-e "discovery.type=single-node" \ | ||
-e OPENSEARCH_INITIAL_ADMIN_PASSWORD="$OPENSEARCH_PASSWORD" \ | ||
opensearch-with-api-plugin | ||
npm ci | ||
npm run dump-cluster-spec -- --opensearch-insecure --output build/opensearch-cluster.yaml | ||
docker stop opensearch | ||
env: | ||
OPENSEARCH_PASSWORD: BobgG7YrtsdKf9M | ||
|
||
- name: Build Spec | ||
shell: bash -eo pipefail {0} | ||
run: | | ||
npm ci | ||
npm run merge -- --source ./spec --output build/opensearch-openapi.yaml | ||
- name: Calculate Coverage | ||
shell: bash -eo pipefail {0} | ||
run: | | ||
npm run coverage:spec -- \ | ||
--cluster build/opensearch-cluster.yaml \ | ||
--specification build/opensearch-openapi.yaml \ | ||
--output build/coverage.yaml | ||
jq . build/coverage.yaml | ||
- name: Display Coverage Checklist | ||
shell: bash -eo pipefail {0} | ||
run: | | ||
jq -sc ' | ||
(map(.endpoints .uncovered | to_entries | sort_by(.value) | map((.value[] | ascii_upcase) + " " + .key)) | .[] | to_entries | map({path: .value, covered: false})) as $uncovered | | ||
(map(.endpoints .covered | to_entries | sort_by(.value) | map((.value[] | ascii_upcase) + " " + .key)) | .[] | to_entries | map({path: .value, covered: true})) as $covered | | ||
$covered+$uncovered | | ||
sort_by(.path) | | ||
map(if .covered then "- [x] \(.path)" else "- [ ] \(.path)" end) | | ||
.[] | ||
' build/coverage.yaml | jq -r |
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