Add tests
This commit is contained in:
parent
3fdcdde652
commit
df7df72e21
24
.cirrus.yml
Normal file
24
.cirrus.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
gcp_credentials: ENCRYPTED[!17c59813193e86cc337bce848b358412b90f50bc5fe1b8b39d363cdf14a41ebe76cfba0482e7f81d076994b9f6dbfb4c!]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CIRRUS_CLONE_DEPTH: 1
|
||||||
|
# Use bash (instead of sh on linux or cmd.exe on windows)
|
||||||
|
CIRRUS_SHELL: bash
|
||||||
|
|
||||||
|
container_definition: &CONTAINER_DEFINITION
|
||||||
|
builder_image_project: language-team
|
||||||
|
builder_image_name: docker-builder-lt-v1
|
||||||
|
cluster_name: cirrus-ci-lt-cluster
|
||||||
|
zone: us-central1-a
|
||||||
|
namespace: default
|
||||||
|
use_in_memory_disk: true
|
||||||
|
|
||||||
|
tests_task:
|
||||||
|
gke_container:
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
<<: *CONTAINER_DEFINITION
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
cpu: 1
|
||||||
|
memory: 1G
|
||||||
|
tests_script:
|
||||||
|
- ./tests.sh
|
5
Dockerfile
Normal file
5
Dockerfile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM alpine
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache bash curl jq
|
||||||
|
|
||||||
|
CMD ["sh"]
|
23
tests.sh
Executable file
23
tests.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Test metadata.json"
|
||||||
|
|
||||||
|
exit_code=0
|
||||||
|
|
||||||
|
for dir in rules/*
|
||||||
|
do
|
||||||
|
dir=${dir%*/}
|
||||||
|
echo ${dir##*/}
|
||||||
|
if test -f "$dir/metadata.json"; then
|
||||||
|
echo "$FILE exists."
|
||||||
|
HAS_TITLE=`cat $dir/metadata.json | jq 'has("title")'`
|
||||||
|
if [ "$HAS_TITLE" != "true" ]; then
|
||||||
|
echo "$dir/metadata.json has no title"
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "no $dir/metadata.json"
|
||||||
|
exit_code=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $exit_code
|
Loading…
x
Reference in New Issue
Block a user