Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/release_header.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Release Header

on:
workflow_dispatch:
push:
branches: [ main ]

env:
DEBIAN_FRONTEND: noninteractive

jobs:
build:
runs-on: intel-ubuntu-22.04

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Build Release Header
run: |
mkdir -p ./generated-hpp
python3 tools/gen_release_header.py include safe.hpp > ./generated-hpp/safe.hpp

- name: Setup github pages
uses: actions/configure-pages@v3

- name: Upload artifacts
uses: actions/upload-pages-artifact@v2
with:
path: ./generated-hpp

deploy:
needs: build

permissions:
contents: read
pages: write
id-token: write

environment:
name: github-pages
url: $${{ steps.deployment.outputs.page_url }}

runs-on: intel-ubuntu-22.04

steps:
- name: Deploy to github pages
id: deployment
uses: actions/deploy-pages@v2
10 changes: 6 additions & 4 deletions tools/gen_release_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

version = os.popen("git describe --tags").read().strip()
visited_includes = set()
root = Path(sys.argv[1]).parent.parent

include_dir = Path(sys.argv[1])
main_header = Path(sys.argv[2])

# store content rather than emit directly
content_lines = []
Expand All @@ -18,7 +20,7 @@


def process(base_filepath):
global version, visited_includes, root
global version, visited_includes, include_dir
global content_lines, system_headers, insert_system_headers_line

if base_filepath not in visited_includes:
Expand All @@ -33,7 +35,7 @@ def process(base_filepath):
insert_system_headers_line = len(content_lines)

sub_filepath = Path(m.group(1))
full_path = root / sub_filepath
full_path = include_dir / sub_filepath

if full_path.exists():
# recurse into a cib header
Expand All @@ -50,7 +52,7 @@ def process(base_filepath):
content_lines.append(line)


process(Path(sys.argv[1]))
process(include_dir / main_header)

# write out the content, when we get to the line number the location to emit
# system headers, write those out before proceeding with the remaining content
Expand Down