Skip to content

Commit

Permalink
jinja validate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CubicrootXYZ committed Sep 2, 2024
1 parent bcd608c commit b867ab0
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/jinja.yaml
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
7 changes: 7 additions & 0 deletions .github/workflows/jinja_test.yaml
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/"
3 changes: 3 additions & 0 deletions tests/jinja/generated/testfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- a
- b
- c
3 changes: 3 additions & 0 deletions tests/jinja/makejinja.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[makejinja]
inputs = ["./templates"]
output = "./generated"
3 changes: 3 additions & 0 deletions tests/jinja/templates/testfile.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for item in ["a", "b", "c"] %}
- {{ item }}
{% endfor %}

0 comments on commit b867ab0

Please sign in to comment.