diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..150469058 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:latest + +RUN apt-get update \ + && apt-get install -y \ + gawk \ + perl \ + sed \ + git \ + python3 \ + python3-pip \ + pandoc \ + biber \ + latexmk \ + texlive \ + texlive-science \ + texlive-fonts-extra \ + texlive-plain-generic \ + texlive-bibtex-extra \ + && apt-get clean + +# Install Python packages, after removing a file that breaks pip. +RUN rm /usr/lib/python3.11/EXTERNALLY-MANAGED +RUN pip install rst2html5 \ + && pip install docutils==0.19 + +RUN apt-get install -y locales \ + && echo "LC_ALL=en_US.UTF-8" >> /etc/environment \ + && echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ + && echo "LANG=en_US.UTF-8" > /etc/locale.conf \ + && locale-gen en_US.UTF-8 + +ENV PATH=${PATH}:/usr/local/bin diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..4557f61af --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,4 @@ +{ + "name": "Dev space", + "dockerFile": "Dockerfile" +} \ No newline at end of file diff --git a/.github/actions/render/action.yml b/.github/actions/render/action.yml index 2f58d4860..95d99c5cb 100644 --- a/.github/actions/render/action.yml +++ b/.github/actions/render/action.yml @@ -4,4 +4,9 @@ author: Deirdre Connolly runs: using: docker # Runs `make all` or something like it - image: ../../../Dockerfile + image: ../../../.devcontainer/Dockerfile + args: + - /bin/sh + - -c + - make + - all diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 48fd6085e..000000000 --- a/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM debian:latest - -RUN apt-get update -RUN apt-get install -y \ - gawk \ - perl \ - sed \ - git \ - python3 \ - python3-pip \ - pandoc \ - biber \ - latexmk \ - texlive \ - texlive-science \ - texlive-fonts-extra \ - texlive-plain-generic \ - texlive-bibtex-extra - -RUN rm /usr/lib/python3.11/EXTERNALLY-MANAGED -RUN pip install rst2html5 - -ENV PATH=${PATH}:/root/.local/bin - -WORKDIR "/zips" -ENTRYPOINT ["make", "all"] diff --git a/Makefile b/Makefile index 91414311a..2767c57c4 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ discard: define PROCESSRST $(eval TITLE := $(shell echo '$(patsubst zips/%,%,$(basename $<))' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||')) -rst2html5 -v --title="$(TITLE)" $< >$@ +rst2html5.py -v --title="$(TITLE)" $< >$@ ./edithtml.sh --rst $@ endef diff --git a/README.rst b/README.rst index ea74f770f..f0b17e41b 100644 --- a/README.rst +++ b/README.rst @@ -41,6 +41,8 @@ Use ``make`` to check that you are using correct and double-check the generated ``rendered/draft-*.html`` file before filing a Pull Request. See `here `__ for the project dependencies. +Consider leveraging `our devcontainer.json `__ for ease of tool aquisition +when working in this repo. NU7 Candidate ZIPs ------------------ diff --git a/README.template b/README.template index 40c98cd9f..2c14015a3 100644 --- a/README.template +++ b/README.template @@ -41,6 +41,8 @@ Use ``make`` to check that you are using correct and double-check the generated ``rendered/draft-*.html`` file before filing a Pull Request. See `here `__ for the project dependencies. +Consider leveraging `our devcontainer.json `__ for ease of tool aquisition +when working in this repo. NU7 Candidate ZIPs ------------------ diff --git a/devcontainer.rst b/devcontainer.rst new file mode 100644 index 000000000..1b363757a --- /dev/null +++ b/devcontainer.rst @@ -0,0 +1,20 @@ +# Using dev containers for editing this repo + +This repo uses devcontainer.json to ease configuring the tools necessary to run ``make``. +You can use [Codespaces](https://docs.github.com/en/codespaces/developing-in-codespaces/developing-in-a-codespace) +to make your contributions and validate your work. +Or when using VS Code, use the "Dev Containers: Reopen in Container" command to create +the docker container with the tools. + +## VS Code experience + +When using VS Code to edit .rst files, the following extensions will add a preview pane, +and otherwise add tooling for the files you may be editing: + +- [Makefile Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.makefile-tools) +- [reStructuredText](https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext) +- [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) +- [reStructuredText Syntax highlighting](https://marketplace.visualstudio.com/items?itemName=trond-snekvik.simple-rst) +- [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) + +Note that these extensions are not endorsed nor been vetted by the Zcash Foundation. diff --git a/render-via-docker.sh b/render-via-docker.sh index c0fe0947e..6022dcf14 100755 --- a/render-via-docker.sh +++ b/render-via-docker.sh @@ -3,5 +3,5 @@ set -efuxo pipefail TAG='zcash-zips-render' -docker build -t "$TAG" . -docker run -v "$(pwd):/zips" "$TAG" +docker build -t "$TAG" .devcontainer +docker run -v "$(pwd):/zips" "$TAG" -w /zips make all