-
-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (69 loc) · 2.74 KB
/
validate.yml
File metadata and controls
81 lines (69 loc) · 2.74 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Validate Datapack
on:
push:
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false # only caches go projects, not general go pkgs
- name: get go cache env
id: go-cache-env
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "GOMODCACHE<<$EOF" >> $GITHUB_ENV
go env GOMODCACHE >> $GITHUB_ENV
echo "$EOF" >> $GITHUB_ENV
echo "GOCACHE<<$EOF" >> $GITHUB_ENV
go env GOCACHE >> $GITHUB_ENV
echo "$EOF" >> $GITHUB_ENV
- name: cache go
uses: actions/cache@v4
with:
path: |
${{env.GOMODCACHE}}
${{env.GOCACHE}}
key: ${{ runner.os }}-gomod
- name: install yajsv
run: go install github.com/neilpa/yajsv@v1.4.1
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: get cache week
id: week
run: echo "value=$(date +%Y-%U)" >> $GITHUB_OUTPUT
- name: cache schemas
id: cache-schemas
uses: actions/cache@v4
with:
path: schemas/
key: ${{ runner.os }}-schemas-${{ steps.week.outputs.value }}
- name: fetch schemas
if: steps.cache-schemas.outputs.cache-hit != 'true'
run: |
curl -fsSL -o schemas/advancement.json https://json.schemastore.org/minecraft-advancement.json
curl -fsSL -o schemas/tag.json https://json.schemastore.org/minecraft-tag.json
curl -fsSL -o schemas/recipe.json https://json.schemastore.org/minecraft-recipe.json
# pack-mcmeta.json is maintained locally (schemastore version is outdated)
- name: Verify pack.mcmeta
run: yajsv -s schemas/pack-mcmeta.json -q "BoxedDataPack/pack.mcmeta"
- name: Verify Advancements
run: |
python3 -c 'from glob import glob;open("globs.txt","w").writelines(f+"\n" for f in glob("BoxedDataPack/data/*/advancements/**/*.json",recursive=True))'
yajsv -s schemas/advancement.json -q -l globs.txt
rm globs.txt
- name: Verify Tags
run: |
python3 -c 'from glob import glob;open("globs.txt","w").writelines(f+"\n" for f in glob("BoxedDataPack/data/*/tags/**/*.json",recursive=True))'
yajsv -s schemas/tag.json -q -l globs.txt
rm globs.txt
- name: Verify Recipes
run: |
python3 -c 'from glob import glob;open("globs.txt","w").writelines(f+"\n" for f in glob("BoxedDataPack/data/*/recipes/**/*.json",recursive=True))'
yajsv -s schemas/recipe.json -q -l globs.txt
rm globs.txt