Skip to content

Commit 3efb5b5

Browse files
committed
Upgrade build process
Signed-off-by: Rafael Sene <rafael@riscv.org>
1 parent e38d8c1 commit 3efb5b5

File tree

4 files changed

+103
-14
lines changed

4 files changed

+103
-14
lines changed

.github/workflows/build.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Specification
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version, e.g. X.Y.Z:'
8+
required: true
9+
type: string
10+
prerelease:
11+
description: 'Tag as a pre-release?'
12+
required: false
13+
type: boolean
14+
default: true
15+
draft:
16+
description: 'Create release as a draft?'
17+
required: false
18+
type: boolean
19+
default: false
20+
pull_request:
21+
push:
22+
branches:
23+
- main
24+
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v3
31+
with:
32+
submodules: 'recursive'
33+
34+
- name: Build Docker Image
35+
run: docker build -t latex-make-env .
36+
37+
- name: Run Container & Compile LaTeX
38+
run: |
39+
docker run --rm -v ${{ github.workspace }}:/data latex-make-env bash -c "\
40+
git config --global --add safe.directory /data && \
41+
make"
42+
43+
# Step 4: Upload the built PDF files as a single artifact
44+
- name: Upload Build Artifacts
45+
uses: actions/upload-artifact@v3
46+
with:
47+
name: Specification Artifact
48+
path: ${{ github.workspace }}/*.pdf
49+
retention-days: 30
50+
51+
# Create Release
52+
- name: Create Release
53+
uses: softprops/action-gh-release@v1
54+
with:
55+
files: ${{ github.workspace }}/*.pdf
56+
tag_name: v${{ github.event.inputs.version }}
57+
name: Release ${{ github.event.inputs.version }}
58+
draft: ${{ github.event.inputs.draft }}
59+
prerelease: ${{ github.event.inputs.prerelease }}
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
62+
if: github.event_name == 'workflow_dispatch'

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Use an official Ubuntu as a parent image
2+
FROM ubuntu:latest
3+
4+
# Set noninteractive mode for apt-get
5+
ARG DEBIAN_FRONTEND=noninteractive
6+
7+
# Update and install latex, git, make and other required tools
8+
RUN apt-get update && \
9+
apt-get install -y --no-install-recommends \
10+
texlive-latex-base \
11+
texlive-fonts-recommended \
12+
texlive-fonts-extra \
13+
texlive-latex-extra \
14+
lmodern \
15+
texlive-science \
16+
make \
17+
git && \
18+
rm -rf /var/lib/apt/lists/*
19+
20+
# Set working directory
21+
WORKDIR /data
22+
23+
# By default, run a shell
24+
CMD ["/bin/bash"]

Makefile

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
SPEC_TEX=riscv-trace-spec
2-
SPEC=$(SPEC_TEX)
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
35

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
6+
# Main Targets
7+
all: $(SPEC_PDF)
58

6-
all: $(SPEC).pdf
9+
publish: $(SPEC_PDF)
10+
cp $< $(SPEC_TEX)-`git rev-parse --abbrev-ref HEAD`.`git rev-parse --short HEAD`.pdf
711

8-
$(SPEC).pdf: $(SPEC_TEX).tex $(INCLUDES_TEX) vc.tex
9-
echo $(SPEC)
10-
pdflatex -shell-escape $< && makeindex $(SPEC_TEX) && pdflatex -shell-escape $<
12+
clean:
13+
rm -f $(SPEC_PDF) *.aux *.toc *.log *.idx *.ilg *.ind *.lof *.lot *.out *.pdf
1114

12-
publish: $(SPEC).pdf
13-
cp $< $(SPEC)-`git rev-parse --abbrev-ref HEAD`.`git rev-parse --short HEAD`.pdf
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 $<
1419

20+
# Recipe for generating vc.tex with Git version control information
1521
vc.tex: .git/logs/HEAD
16-
# https://thorehusfeldt.net/2011/05/13/including-git-revision-identifiers-in-latex/
1722
echo "%%% This file is generated by Makefile." > vc.tex
1823
echo "%%% Do not edit this file!\n%%%" >> vc.tex
1924
git log -1 --format="format:\
@@ -22,11 +27,9 @@ vc.tex: .git/logs/HEAD
2227
\\gdef\\GITAuthorDate{%ad}\
2328
\\gdef\\GITAuthorName{%an}" >> vc.tex
2429

30+
# Recipe for generating changelog.tex from Git logs
2531
changelog.tex: .git/logs/HEAD Makefile
2632
echo "%%% This file is generated by Makefile." > changelog.tex
2733
echo "%%% Do not edit this file!\n%%%" >> changelog.tex
2834
git log --no-merges --date=short --pretty="format:vhEntry{%h}{%ad}{%an}{%s}" | \
29-
sed -e "s,\\\\,{\\\\textbackslash},g" -e "s,[_#^],\\\\&,g" -e s/^/\\\\/ >> changelog.tex
30-
31-
clean:
32-
rm -f $(SPEC).pdf *.aux $(SPEC).toc $(SPEC).log $(SPEC).aux $(SPEC).idx $(SPEC).ilg $(SPEC).ind $(SPEC).lof $(SPEC).log $(SPEC).lot $(SPEC).out $(SPEC).pdf $(SPEC).toc
35+
sed -e "s,\\\\,{\\\\textbackslash},g" -e "s,[_#^],\\\\&,g" -e s/^/\\\\/ >> changelog.tex

riscv-trace-spec.pdf

-922 KB
Binary file not shown.

0 commit comments

Comments
 (0)