diff --git a/.github/workflows/jinja.yaml b/.github/workflows/jinja.yaml new file mode 100644 index 0000000..ea0ba9c --- /dev/null +++ b/.github/workflows/jinja.yaml @@ -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 \ No newline at end of file diff --git a/.github/workflows/jinja_test.yaml b/.github/workflows/jinja_test.yaml new file mode 100644 index 0000000..5b36e9e --- /dev/null +++ b/.github/workflows/jinja_test.yaml @@ -0,0 +1,7 @@ +on: push + +jobs: + jinja: + uses: ./.github/workflows/jinja.yaml + with: + workdir: "tests/jinja/" \ No newline at end of file diff --git a/tests/jinja/generated/testfile.yml b/tests/jinja/generated/testfile.yml new file mode 100644 index 0000000..d729eb6 --- /dev/null +++ b/tests/jinja/generated/testfile.yml @@ -0,0 +1,3 @@ +- a +- b +- c diff --git a/tests/jinja/makejinja.toml b/tests/jinja/makejinja.toml new file mode 100644 index 0000000..010760a --- /dev/null +++ b/tests/jinja/makejinja.toml @@ -0,0 +1,3 @@ +[makejinja] +inputs = ["./templates"] +output = "./generated" \ No newline at end of file diff --git a/tests/jinja/templates/testfile.yml.jinja b/tests/jinja/templates/testfile.yml.jinja new file mode 100644 index 0000000..5c84552 --- /dev/null +++ b/tests/jinja/templates/testfile.yml.jinja @@ -0,0 +1,3 @@ +{% for item in ["a", "b", "c"] %} +- {{ item }} +{% endfor %} \ No newline at end of file