-
Notifications
You must be signed in to change notification settings - Fork 6
60 lines (56 loc) · 2.19 KB
/
validate_json.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# This is built on GitHub's "basic workflow to help you get started with Actions"
name: JSON validation CI
# Controls when the action will run. Triggers the workflow on push or pull request
on:
push:
branches:
- master
pull_request:
branches:
- '**'
jobs:
verify-json-validation:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Install weedcoco
run: pip install .
- name: Run import tools on test data
run: |
cd weedcoco/cwfid_to_json/
curl -L https://github.com/cwfid/dataset/archive/36290d0.tar.gz | tar xzv
mv dataset-36290d0*/* .
mv images cwfid_images
python -m weedcoco.importers.cwfid --image-dir cwfid_images -o cwfid_imageinfo.json
cat cwfid_imageinfo.json
cd ../deepweeds_to_json
curl -L https://github.com/AlexOlsen/DeepWeeds/archive/51e3fab.tar.gz | tar xzv
mv DeepWeeds-51e3fab*/* .
# fake some images: make them all be a pic from cwfid
mkdir deepweeds_images_full
for fname in $(cut -d, -f1 < labels.csv); do ln -s ../../cwfid_to_json/cwfid_images/001_image.png deepweeds_images_full/$fname; done
python -m weedcoco.importers.deepweeds --labels-dir labels --image-dir deepweeds_images_full -o deepweeds_imageinfo.json
- name: Validate WeedCOCO
run: |
# TODO: include --images-root
python -m weedcoco.validation weedcoco/cwfid_to_json/cwfid_imageinfo.json
python -m weedcoco.validation weedcoco/deepweeds_to_json/deepweeds_imageinfo.json
# Backup validation with ajv
- name: Compile yaml schema to JSON
run: |
pip install pyyaml
cd weedcoco/schema
make
- name: Check schemas in web match
run: |
for f in search/src/Schemas/*.json; do diff $f weedcoco/schema/$(basename $f) || exit 1; done
- uses: actions/setup-node@v1
with:
node-version: '10'