mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-11-03 21:05:47 +03:00
4a7f02cd0d
* We move all the example code from the readme to the `examples` folder. * We provide a `scripts/build-readme.sh` script that inlines referenced examples in `README.md.in` and outputs `README.md`. The script also verifies that the output readme is the same as in version control. * We provide a `scripts/build-examples.py` script that builds the Yaml output for all examples. The script also verifies that the generated Yaml files are the same as in version control.
43 lines
1.9 KiB
Python
Executable File
43 lines
1.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
#
|
|
# Typecheck and resolve all Dhall files in the ./default directory.
|
|
#
|
|
# Exit with 1 if at least one file fails to check.
|
|
#
|
|
# Some files are ingnored because they have existing errors.
|
|
|
|
import sys
|
|
from glob import glob
|
|
from subprocess import run, DEVNULL, PIPE
|
|
|
|
# We skip tests for the following set of files
|
|
ignored_failures = {
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionSpec.dhall',
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceValidation.dhall',
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps.dhall',
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinition.dhall',
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.CustomResourceDefinitionList.dhall',
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrArray.dhall',
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrBool.dhall',
|
|
'./default/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaPropsOrStringArray.dhall',
|
|
}
|
|
|
|
default_files = glob('./default/*.dhall')
|
|
failure_files = set()
|
|
for default_file in default_files:
|
|
if default_file in ignored_failures:
|
|
print('Skipping {}'.format(default_file))
|
|
continue
|
|
print('Checking {}'.format(default_file))
|
|
cmd = 'dhall resolve <<< {file}'.format(file=default_file)
|
|
result = run(cmd, shell=True, executable='bash', stdout=DEVNULL, stderr=PIPE)
|
|
if result.returncode != 0:
|
|
print(result.stderr.decode('utf-8'))
|
|
failure_files.add(default_file)
|
|
|
|
if len(failure_files) > 0:
|
|
print('The following files failed to check:')
|
|
for failure_file in failure_files:
|
|
print(' ' + failure_file)
|
|
sys.exit(1)
|