-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from CubicrootXYZ/jinja-validator
add jinja validate workflow
- Loading branch information
Showing
6 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
workdir: | ||
required: false | ||
default: "./" | ||
type: string | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
if: "!startsWith(github.ref, 'refs/tags/')" | ||
container: | ||
image: cubicrootxyz/jinja:v0.0.3 | ||
options: --user root | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
- name: Run tests | ||
run: (cd ${{ inputs.workdir }} && makejinja) | ||
- name: Check for diffs | ||
run: git diff --exit-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
on: push | ||
|
||
jobs: | ||
jinja: | ||
uses: ./.github/workflows/jinja.yaml | ||
with: | ||
workdir: "tests/jinja/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,18 @@ jobs: | |
workdir: "tests/golang_test/" | ||
services: '{"database": {"image": "mysql:8.0", "ports": ["3306:3306"]}}' | ||
env: '{"TESTENV": "value"}' | ||
``` | ||
|
||
## Jinja | ||
|
||
### Validate generates are up to date | ||
|
||
Add the following job to your CI to ensure `jinja` generated files are always up to date. Uses `makejinja` for templating. | ||
|
||
```yaml | ||
jobs: | ||
jinja: | ||
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected] | ||
with: | ||
workdir: "tests/jinja/" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- a | ||
- b | ||
- c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[makejinja] | ||
inputs = ["./templates"] | ||
output = "./generated" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% for item in ["a", "b", "c"] %} | ||
- {{ item }} | ||
{% endfor %} |