-
Notifications
You must be signed in to change notification settings - Fork 9
48 lines (44 loc) · 1.66 KB
/
check.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
name: Test render
on:
pull_request:
branches: [main]
permissions:
contents: read
env:
# Generate diffs relative to our downstream PR branch, not to downstream Git
# main. This omits changes that have merged in repo-templates but haven't
# merged downstream yet, making review easier. The Makefile does the same
# when generating diffs for interactive development.
FORK_ARGS: --fork-regex /coreos/ --fork-replacement /coreosbot-releng/ --fork-branch repo-templates
jobs:
render:
name: Render
runs-on: ubuntu-latest
container: registry.fedoraproject.org/fedora:latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install dependencies
run: dnf install -y cargo git-core python3-pyyaml
- name: Check for unreferenced templates
run: |
python3 -c 'import yaml; print("\n".join(yaml.safe_load(open("config.yaml"))["templates"]))' |
sed -e 's/\.[a-z0-9]*$/.yaml/' -e '/^[^.]*$/ s/$/.yaml/' > expected
stray=$(find . -path ./config.yaml -prune -o -name '*.yaml' -print |
sed 's:^\./::' |
grep -Fvxf expected ||:)
if [ -n "${stray}" ]; then
echo "Found template configs not referenced in config.yaml:"
echo "${stray}"
exit 1
fi
- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: tmpl8
- name: Build tmpl8 binary
run: cd tmpl8 && cargo build
- name: Sync cache
run: tmpl8/target/debug/tmpl8 update-cache $FORK_ARGS
- name: Render diffs
run: tmpl8/target/debug/tmpl8 diff $FORK_ARGS