liquid
liquid copied to clipboard
CI should test whether generated files match latest sources
The CI should test whether the generated files (expressions.go and y.go) match the sources.
The following GitHub Action will do this:
- name: Test generated code
- run: |
make generate
git diff --exit-code
The missing pieces are:
1. Installing Ragel
This works:
- name: Install Ragel
run: |
sudo apt-get update
sudo apt-get install
However, this requires apt-get update and apt-get install on each run.
Is there a way to cache this? Alternatively, should this action use a Docker image that includes Ragel?
2. Installing goyacc
I tried this:
Add a step:
- name: Install generators
run: make setup
- name: Run generators
run: make generate
(make setup includes go install golang.org/x/tools/cmd/goyacc. make generate runs go generate ./....)
This produces an error:
expressions/parser.go:3: running "goyacc": exec: "goyacc": executable file not found in $PATH
make: *** [Makefile:24: generate] Error 1
Error: Process completed with exit code 2.