From e900d76aaaa171496d6fefa28ce07e3364500743 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 25 Oct 2020 18:14:46 -0600 Subject: just build with make --- .build.yml | 27 +++++++-------------------- .editorconfig | 3 +++ .gitignore | 1 + Dockerfile | 17 +++++++++++++++++ Makefile | 23 +++++++++++++++++++++++ 5 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/.build.yml b/.build.yml index 17e4941..ec6df1a 100644 --- a/.build.yml +++ b/.build.yml @@ -8,27 +8,14 @@ sources: environment: files: "index vs-c tagged-unions types safety errors syntax LICENSE" tasks: - - build-html: | + - build: | cd crowbar-spec - i=0 - for file in $files - do - pandoc --defaults=etc/md.yml --number-offset=$i -o $file.html $file.md - i=$((i+1)) - done - tar czvf ../spec-html.tar.gz *.html - - build-pdf: | - cd crowbar-spec - if git describe --tags --exact-match 2>/dev/null - then - metadata="subtitle=$(git describe --tags --exact-match)" - else - metadata="version=$(git log -1 --no-decorate --oneline)" - fi - pandoc --defaults=etc/pdf.yml -o ../spec.pdf -M "$metadata" $(echo $files | awk '{ for (i=1; i<=NF; i++) printf "%s.html ", $i }') + make + - compress: | + tar czf spec-html.tar.gz crowbar-spec/*.html - test-page-count: | - pages=$(pdfinfo spec.pdf | grep Pages | awk '{ print $2 }') - test $pages -le 200 + cd crowbar-spec + make check artifacts: - - spec.pdf + - crowbar-spec/spec.pdf - spec-html.tar.gz diff --git a/.editorconfig b/.editorconfig index d3fcdc6..f4dfbaa 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,3 +6,6 @@ insert_final_newline = true indent_style = space indent_size = 4 charset = utf-8 + +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore index 9b61c8c..17a66eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /*.html +/spec.pdf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c84125c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM debian:testing-slim AS build + +RUN apt-get update && apt-get install -y \ + pandoc \ + weasyprint \ + poppler-utils \ + make \ + && rm -rf /var/lib/apt/lists/* + +ADD . /src +WORKDIR /src +RUN make + +FROM nginx:alpine + +COPY --from=build /src/*.html /usr/share/nginx/html/ +COPY --from=build /src/spec.pdf /usr/share/nginx/html/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f5f30d3 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +SRC = index.md vs-c.md tagged-unions.md types.md safety.md errors.md syntax.md LICENSE.md +HTML = $(SRC:%.md=%.html) + +spec.pdf: $(HTML) + if git describe --tags --exact-match 2>/dev/null; \ + then \ + metadata="subtitle=$(git describe --tags --exact-match)"; \ + else \ + metadata="version=$(git log -1 --no-decorate --oneline)"; \ + fi; \ + pandoc --defaults=etc/pdf.yml -M "$$metadata" -o $@ $(HTML) + +%.html: %.md + offset=`echo $(SRC) | awk '{for (i=1; i<=NF; i++) if ($$i == "$<") print (i-1) }'`; \ + pandoc --defaults=etc/md.yml --number-offset=$$offset -o $@ $< + +clean: + rm -f $(HTML) spec.pdf + +check: spec.pdf + test $$(pdfinfo spec.pdf | grep Pages | awk '{ print $$2 }') -le 200 + +.PHONY: clean check -- cgit v1.2.3