Skip to content

Commit 02ac598

Browse files
Merge pull request #91 from riscv-non-isa/asciidoc
Move spec to AsciiDoc
2 parents 3efb5b5 + 6bee64d commit 02ac598

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4571
-4750
lines changed

.github/workflows/build-pdf.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Create Specification Document
2+
3+
# The workflow is triggered by pull request, push to main, and manual dispatch.
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Release version, e.g. X.Y.Z:'
9+
required: true
10+
type: string
11+
revision_mark:
12+
description: 'Set revision mark as Draft, Release or Stable:'
13+
required: true
14+
type: string
15+
default: 'Draft'
16+
prerelease:
17+
description: 'Tag as a pre-release?'
18+
required: false
19+
type: boolean
20+
default: true
21+
draft:
22+
description: 'Create release as a draft?'
23+
required: false
24+
type: boolean
25+
default: false
26+
pull_request:
27+
push:
28+
branches:
29+
- main
30+
31+
jobs:
32+
build:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
# Step 1: Checkout the repository
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
with:
40+
submodules: 'recursive'
41+
42+
# Step 2: Pull the latest RISC-V Docs container image
43+
- name: Pull Container
44+
run: docker pull riscvintl/riscv-docs-base-container-image:latest
45+
46+
# Step 3: Build Files
47+
- name: Build Files
48+
run: make
49+
env:
50+
VERSION: v${{ github.event.inputs.version }}
51+
REVMARK: ${{ github.event.inputs.revision_mark }}
52+
53+
# Step 4: Upload the built PDF files as a single artifact
54+
- name: Upload Build Artifacts
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: Build Artifacts
58+
path: ${{ github.workspace }}/*.pdf
59+
retention-days: 30
60+
61+
# Create Release
62+
- name: Create Release
63+
uses: softprops/action-gh-release@v1
64+
with:
65+
files: ${{ github.workspace }}/*.pdf
66+
tag_name: v${{ github.event.inputs.version }}
67+
name: Release ${{ github.event.inputs.version }}
68+
draft: ${{ github.event.inputs.draft }}
69+
prerelease: ${{ github.event.inputs.prerelease }}
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
72+
if: github.event_name == 'workflow_dispatch'
73+
# This condition ensures this step only runs for workflow_dispatch events.

.github/workflows/build.yaml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
vc.tex
2+
.vscode
3+
*.pdf
4+
stem*.svg

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "docs-resources"]
2+
path = docs-resources
3+
url = https://github.com/riscv/docs-resources.git

Makefile

100755100644
Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,62 @@
1-
# Variables
2-
SPEC_TEX := riscv-trace-spec
3-
SPEC_PDF := $(SPEC_TEX).pdf
4-
INCLUDES_TEX := introduction.tex branchTrace.tex exampleAlgorithm.tex filtering.tex timestamping.tex ingressPort.tex payload.tex dataTracePayload.tex control.tex preamble.tex riscv-trace-spec.tex decoder.tex discovery.tex exampleCodeSnippets.tex fragmentCodeAndTransport.tex future.tex
1+
# Makefile for RISC-V Doc Template
2+
#
3+
# This work is licensed under the Creative Commons Attribution-ShareAlike 4.0
4+
# International License. To view a copy of this license, visit
5+
# http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to
6+
# Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
7+
#
8+
# SPDX-License-Identifier: CC-BY-SA-4.0
9+
#
10+
# Description:
11+
#
12+
# This Makefile is designed to automate the process of building and packaging
13+
# the Doc Template for RISC-V Extensions.
514

6-
# Main Targets
7-
all: $(SPEC_PDF)
15+
#DATE ?= $(shell date +%Y-%m-%d)
16+
#VERSION ?= v0.0.0
17+
#REVMARK ?= Draft
18+
DOCKER_RUN := docker run --rm -v ${PWD}:/build -w /build \
19+
riscvintl/riscv-docs-base-container-image:latest
820

9-
publish: $(SPEC_PDF)
10-
cp $< $(SPEC_TEX)-`git rev-parse --abbrev-ref HEAD`.`git rev-parse --short HEAD`.pdf
21+
HEADER_SOURCE := header.adoc
22+
PDF_RESULT := riscv-trace-spec-asciidoc.pdf
23+
24+
25+
ASCIIDOCTOR_PDF := asciidoctor-pdf
26+
OPTIONS := --trace \
27+
-a compress \
28+
-a mathematical-format=svg \
29+
--failure-level=ERROR
30+
REQUIRES := --require=asciidoctor-diagram \
31+
--require=asciidoctor-mathematical
32+
# --require=~/bin/pdf-converter-colophon-placement.rb
33+
#--require=asciidoctor-bibtex \
34+
35+
.PHONY: all build clean build-container build-no-container
36+
37+
all: build
38+
39+
build:
40+
@echo "Checking if Docker is available..."
41+
@if command -v docker >/dev/null 2>&1 ; then \
42+
echo "Docker is available, building inside Docker container..."; \
43+
$(MAKE) build-container; \
44+
else \
45+
echo "Docker is not available, building without Docker..."; \
46+
$(MAKE) build-no-container; \
47+
fi
48+
49+
build-container:
50+
@echo "Starting build inside Docker container..."
51+
$(DOCKER_RUN) /bin/sh -c "$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)"
52+
@echo "Build completed successfully inside Docker container."
53+
54+
build-no-container:
55+
@echo "Starting build..."
56+
$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)
57+
@echo "Build completed successfully."
1158

1259
clean:
13-
rm -f $(SPEC_PDF) *.aux *.toc *.log *.idx *.ilg *.ind *.lof *.lot *.out *.pdf
14-
15-
# Recipe for building the PDF
16-
$(SPEC_PDF): $(SPEC_TEX).tex $(INCLUDES_TEX) vc.tex
17-
echo $(SPEC_TEX)
18-
pdflatex -shell-escape $< && makeindex $(SPEC_TEX) && pdflatex -shell-escape $<
19-
20-
# Recipe for generating vc.tex with Git version control information
21-
vc.tex: .git/logs/HEAD
22-
echo "%%% This file is generated by Makefile." > vc.tex
23-
echo "%%% Do not edit this file!\n%%%" >> vc.tex
24-
git log -1 --format="format:\
25-
\\gdef\\GITHash{%H}\
26-
\\gdef\\GITAbrHash{%h}\
27-
\\gdef\\GITAuthorDate{%ad}\
28-
\\gdef\\GITAuthorName{%an}" >> vc.tex
29-
30-
# Recipe for generating changelog.tex from Git logs
31-
changelog.tex: .git/logs/HEAD Makefile
32-
echo "%%% This file is generated by Makefile." > changelog.tex
33-
echo "%%% Do not edit this file!\n%%%" >> changelog.tex
34-
git log --no-merges --date=short --pretty="format:vhEntry{%h}{%ad}{%an}{%s}" | \
35-
sed -e "s,\\\\,{\\\\textbackslash},g" -e "s,[_#^],\\\\&,g" -e s/^/\\\\/ >> changelog.tex
60+
@echo "Cleaning up generated files..."
61+
rm -f $(PDF_RESULT)
62+
@echo "Cleanup completed."

0 commit comments

Comments
 (0)