-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to make sure generated CI file is up to date (#59)
- Loading branch information
Showing
4 changed files
with
51 additions
and
20 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,40 @@ | ||
name: Check Generated CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches-ignore: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
update: | ||
name: "Update" | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Install jinja | ||
run: python -m pip install jinja2 | ||
- name: Generate CI | ||
run: .github/workflows/gen_ci.py | ||
- name: Add untracked files to index so they count as changes | ||
run: git add -A | ||
- name: Check output | ||
run: git --no-pager diff --exit-code HEAD | ||
- name: Generate diff | ||
run: git diff HEAD > ci-fixes.patch | ||
if: ${{ failure() }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ci-fixes | ||
path: ci-fixes.patch | ||
if: ${{ failure() }} |
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
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
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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
#!/usr/bin/env python | ||
|
||
from os import path | ||
from jinja2 import Environment, FileSystemLoader | ||
import json | ||
|
||
with open(f"targets.json") as f: | ||
workdir = path.dirname(__file__) | ||
with open(path.join(workdir, "targets.json")) as f: | ||
targets = json.load(f) | ||
|
||
env = Environment(loader=FileSystemLoader(f"."), autoescape=False) | ||
env = Environment(loader=FileSystemLoader(workdir), autoescape=False, keep_trailing_newline=True) | ||
template = env.get_template("ci.yml.jinja") | ||
contents = template.render(targets=targets) | ||
with open("ci.yml", "w") as f: | ||
with open(path.join(workdir, "ci.yml"), "w") as f: | ||
f.write(contents) |