Skip to content
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

ci: schema yaml & yml + verbose #84

Merged
merged 8 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions .github/workflows/check-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,41 @@ jobs:
submodules: recursive

- name: Install dependencies
run: pip install check-jsonschema
run: |
pip install check-jsonschema -q
pip list | grep "check-jsonschema"

- name: Scan repo
run: python -c "import os; is_dir = os.path.isdir('.github/actions'); print(f'GH_ACTIONS={int(is_dir)}')" >> $GITHUB_ENV
id: folders
run: python -c "import os; print('gh_actions=' + str(int(os.path.isdir('.github/actions'))))" >> $GITHUB_OUTPUT

# https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
- name: GitHub Actions - workflow
run: check-jsonschema -v $(find .github/workflows -name '*.yml' -a ! -name '_*.yml') --builtin-schema "github-workflows"
run: |
files=$(find .github/workflows -name '*.yml' -or -name '*.yaml' -not -name '__*')
for f in $files; do
echo $f;
check-jsonschema -v $f --builtin-schema "github-workflows";
done

# https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-action.json
- name: GitHub Actions - action
if: ${{ env.GH_ACTIONS == '1' }}
run: check-jsonschema -v .github/actions/*/*.yml --builtin-schema "github-actions"
if: steps.folders.outputs.gh_actions == '1'
run: |
files=$(find .github/actions -name '*.yml' -or -name '*.yaml')
for f in $files; do
echo $f;
check-jsonschema -v $f --builtin-schema "github-actions";
done

# https://github.com/microsoft/azure-pipelines-vscode/blob/main/service-schema.json
- name: Azure Pipelines
if: ${{ inputs.azure-dir != '' }}
env:
SCHEMA_FILE: https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/v1.205.0/service-schema.json
SCHEMA_FILE: https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/v1.208.0/service-schema.json
run: |
check-jsonschema -v ${{ inputs.azure-dir }}/*.yml --schemafile "$SCHEMA_FILE"
files=$(find ${{ inputs.azure-dir }} -name '*.yml' -or -name '*.yaml')
for f in $files; do
echo $f;
check-jsonschema -v $f --schemafile "$SCHEMA_FILE";
done
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Apply local actions in re-usable workflows ([#51](https://github.com/Lightning-AI/utilities/pull/51))
- CI: abstract package actions ([#48](https://github.com/Lightning-AI/utilities/pull/48))
- CI: Checkout submodules recursive ([#82](https://github.com/Lightning-AI/utilities/pull/82))


### Fixed

- CI: Checking schem in both yaml & yml + verbose ([#84](https://github.com/Lightning-AI/utilities/pull/84))

### Removed

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Lightning Utilities

[![UnitTests](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml/badge.svg?event=push)](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml)
[![Apply checks](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yml/badge.svg?event=push)](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yml)
[![Apply checks](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml/badge.svg?event=push)](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml)
[![Documentation Status](https://readthedocs.org/projects/lightning_utilities/badge/?version=latest)](https://lightning-tools.readthedocs.io/en/latest/?badge=latest)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Lightning-AI/utilities/main.svg)](https://results.pre-commit.ci/latest/github/Lightning-AI/utilities/main)

Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
actions-ref: main # normally you shall use the same version as the workflow
```

See usage of other workflows in [.github/workflows/ci-use-checks.yml](https://github.com/Lightning-AI/utilities/tree/main/.github/workflows/ci-use-checks.yml).
See usage of other workflows in [.github/workflows/ci-use-checks.yaml](https://github.com/Lightning-AI/utilities/tree/main/.github/workflows/ci-use-checks.yaml).

## 2. Reusable composite actions

Expand Down