Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Using grep to write tests in CI#
GitHub Actions workflows fail if any of the steps executes something that returns a non-zero exit code.
Today I learned that grep returns a non-zero exit code if it fails to find any matches.
This means that piping to grep is a really quick way to write a test as part of an Actions workflow.
I wrote a quick soundness check today using the new datasette --get /path option, which runs a fake HTTP request for that path through Datasette and returns the response to standard out. Here’s an example:
1 - name: Build database2 run: scripts/build.sh3 - name: Run tests4 run: |5 datasette . --get /us/pillar-point | grep 'Rocky Beaches'6 - name: Deploy to VercelI like this pattern a lot: build a database for a custom Datasette deloyment in CI, run one or more quick soundness checks using grep, then deploy if those checks pass.