From 4946aff2be89c7f4c859bd46403860b7751c13d0 Mon Sep 17 00:00:00 2001 From: yangyf83 Date: Mon, 29 Apr 2024 21:22:36 +0800 Subject: [PATCH 1/2] Add devcontainer support and update gh actions checkout version - Update actions/checkout to v4 - Add devcontainer support --- .devcontainer/Dockerfile | 18 ++++++++++++++++++ .devcontainer/devcontainer.json | 15 +++++++++++++++ .github/workflows/test.yml | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..1c4d06d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,18 @@ +FROM texlive/texlive:TL2022-historic + +# Install additional packages & fonts +RUN apt-get update -y \ + && \ + apt-get install -y --no-install-recommends apt-transport-https ca-certificates software-properties-common \ + && \ + sed -i '/^\([^#].*main\)*$/s/main/& contrib non-free/' /etc/apt/sources.list \ + && \ + apt-get update -y \ + && \ + apt-get install --no-install-recommends -y ttf-mscorefonts-installer make fonts-arphic-ukai fonts-noto-cjk-extra \ + && \ + fc-cache + +ENV SHELL /bin/bash + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3767ac8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +{ + "build":{ + "dockerfile": "Dockerfile" + }, + + "customizations": { + "vscode": { + "extensions": [ + "ms-ceintl.vscode-language-pack-zh-hans", + "james-yu.latex-workshop", + "nickfode.latex-formatter" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f08bc88..a1401bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Compile run: | From de6fb94e3d65f5f8b722ed4ea68520b067250ff4 Mon Sep 17 00:00:00 2001 From: yangyf83 Date: Mon, 29 Apr 2024 21:54:36 +0800 Subject: [PATCH 2/2] update readme --- .devcontainer/devcontainer.json | 3 +-- README.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3767ac8..44b60d6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,8 +1,7 @@ { - "build":{ + "build": { "dockerfile": "Dockerfile" }, - "customizations": { "vscode": { "extensions": [ diff --git a/README.md b/README.md index 7f53298..8e8d015 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,18 @@ 还可以使用 `git tag`,其会像本仓库一样将构建好的 artifact 永久发布到 [releases](https://github.com/SYSU-SCC/sysu-thesis/releases) 中。 +### Devcontainer 编辑(本地 & 在线) + +> [!IMPORTANT] +> 无论是本地还是在线编辑,都需要首先创建自己的论文仓库,在自己的仓库进行修改,并建议及时 `commit & push` 到远程仓库进行备份。 + +本模板提供了 [VS Code Remote - Containers](https://code.visualstudio.com/docs/remote/containers) 相关配置文件,包含了 texlive 2022 和 VS Code 中文和 LaTeX Workshop 插件,可用于本地或在线容器化编辑。 + +- 对于在线编辑,可以使用 [GitHub Codespaces](https://docs.github.com/zh/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository) 通过浏览器版本的 VS Code 进行编辑。(请注意,GitHub Codespaces 每月免费额度有限,请注意用量)。 +- 而对于本地编辑,需要安装 [Docker](https://docs.docker.com/get-docker/) 和 [VS Code](https://code.visualstudio.com/),并在 VSCode 中安装 [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) 插件。随后打开本仓库,键入 `F1`,选择 `Remote-Containers: Reopen in Container` 即可构建进入容器环境。 + +在容器环境中,可以使用 `make pdf` 进行编译并生成 `main.pdf` 文件,或者使用 LaTeX Workshop 插件进行编译与预览。 + ### texlive 编辑(本地) 本模板需要使用 texlive(>=2020) 进行编译,编译命令如下: