zjuthesis icon indicating copy to clipboard operation
zjuthesis copied to clipboard

多平台CI

Open TheNetAdmin opened this issue 3 years ago • 6 comments

可改进的内容

现在的 CI 只有 Linux 环境,但 GitHub Action 支持 Windows 以及 MacOS 平台的 CI,可以将这些 CI 加入本 repo 中

代码与步骤

可参考 ctex-kit 的 CI: https://github.com/CTeX-org/ctex-kit/blob/master/.github/workflows/test.yml

TheNetAdmin avatar Oct 25 '20 19:10 TheNetAdmin

刚在 GitHub Action 的 MacOS runner 上运行 fc-list 查看字体,发现有安装黑体,宋体,楷体,但没有仿宋……

macos-ci.log

过两天抽空查查怎么通过命令行安装 MacOS 提供的仿宋字体。

TheNetAdmin avatar Oct 30 '20 23:10 TheNetAdmin

测试了一下,可以这样手动安装仿宋

    - name: Get Fangsong font
      run: |
        wget http://www.fontineed.com/downloads/STFangsong.zip
        unzip STFangsong.zip
        cp -vf *.ttf /Library/Fonts/

结果

2020-10-31T03:50:40.5525450Z /Library/Fonts/stfangso.ttf: STFangsong,华文仿宋:style=Regular

TheNetAdmin avatar Oct 31 '20 03:10 TheNetAdmin

如下代码可以用于在 macos runner 上安装 TeXLive,但 macos runner 太贵了(10 倍于普通 Linux runner 的价格),暂时放弃使用 macos runner


name: Build Tests

env:
  CTAN_URL: https://mirrors.rit.edu/CTAN
  TL_PACKAGES: adobemapping amsfonts amsmath atbegshi cjk cjkutils cm ctablestack currfile dvipdfmx ec epstopdf-pkg etex etoolbox euenc fancyhdr fandol filehook fontspec graphics graphics-cfg graphics-def iftex l3build l3experimental l3kernel l3packages latex-bin lm lm-math ltxcmds lualatex-math lualibs luaotfload luatex luatex85 luatexbase luatexja metafont mfware ms oberdiek platex-tools tex tex-ini-files tools trimspaces ucharcat ulem unicode-data uplatex varwidth xcolor xetex xkeyval xunicode
  TL_EXTRA_PACKAGES: amscls atveryend auxhook beamer bibunits bigintcalc bitset booktabs caption carlisle cjkpunct cleveref context enumitem environ eso-pic etexcmds everyhook fontaxes footmisc geometry gettitlestring hycolor hyperref infwarerr intcalc kastrup koma-script kvdefinekeys kvoptions kvsetkeys letltxmacro mweights natbib newtx notoccite ntheorem pdfescape pdflscape pdfpages pdftexcmds pgf pkuthss psnfss refcount rerunfilecheck sansmathaccent setspace soul svn-prov tex-gyre tex-gyre-math thuthesis titlesec tocloft translator txfonts unicode-math uniquecounter url xecjk xits xstring zhmetrics zhmetrics-uptex zhnumber
  TL_ZJUTHESIS_PACKAGES: amsmath background biblatex bookmark caption chngcntr ctex currfile enumitem etoolbox fancyhdr float fontspec geometry hyperref latexmk listings makecell multido multirow pdfpages physics siunitx titlesec tocloft ulem xifthen

on:
  push:

jobs:
  build_mac:
    runs-on: macos-latest
    if: "!contains(github.event.head_commit.message, '[ci skip]')"
    steps:
    - name: Checkout Repo
      uses: actions/checkout@v1
    - name: Current version
      run: echo $GITHUB_REF
    - name: Get Fangsong font
      run: |
        wget http://www.fontineed.com/downloads/STFangsong.zip
        unzip STFangsong.zip
        cp -vf *.ttf /Library/Fonts/
    - name: Install TeX Live
      run: |
        export PATH=/tmp/texlive/bin/x86_64-darwin:$PATH
        curl -O ${{ env.CTAN_URL }}/systems/texlive/tlnet/install-tl-unx.tar.gz
        tar -xzf install-tl-unx.tar.gz
        cd install-tl-20* && ./install-tl --profile ../.github/workflows/texlive.profile
        tlmgr install ${{ env.TL_PACKAGES }} ${{ env.TL_EXTRA_PACKAGES }} ${{ env.TL_ZJUTHESIS_PACKAGES }}
        tlmgr update --self --all --no-auto-install --repository=${{ env.CTAN_URL }}/systems/texlive/tlnet/
    - name: Build sample pdfs
      run: |
        export PATH=/tmp/texlive/bin/x86_64-darwin:$PATH
        bash $GITHUB_WORKSPACE/script/ci/github-action/build_mac.sh
    - name: Upload Output Files
      uses: actions/upload-artifact@v1
      with:
        name: dist
        path: dist
    - name: Upload Log Files
      uses: actions/upload-artifact@v1
      with:
        name: out-ci
        path: out-ci
# .github/workflows/texlive.profile
# From latex3
# https://github.com/latex3/latex3/blob/master/support/texlive.profile

selected_scheme     scheme-infraonly
TEXDIR              /tmp/texlive
TEXMFSYSCONFIG      /tmp/texlive/texmf-config
TEXMFSYSVAR         /tmp/texlive/texmf-var
TEXMFLOCAL          /tmp/texlive/texmf-local
TEXMFHOME           ~/texmf
TEXMFCONFIG         ~/.texlive/texmf-config
TEXMFVAR            ~/.texlive/texmf-var
option_doc          0
option_src          0
tlpdbopt_autobackup 0

另外,以上 ci 运行时间过长,安装 5min,编译超过 6min 被我手动停止,过后有空可以查看一下具体原因

TheNetAdmin avatar Nov 25 '20 22:11 TheNetAdmin

最近发现 GitHub Action 只对 Private Repo 有限额,可以重新考虑使用多平台 CI

TheNetAdmin avatar Jan 09 '21 22:01 TheNetAdmin

最近发现 GitHub Action 只对 Private Repo 有限额,可以重新考虑使用多平台 CI

About billing for GitHub Actions

Usage limits

muzimuzhi avatar Jan 09 '21 22:01 muzimuzhi

About billing for GitHub Actions

Usage limits

之前是在 private repo 里测试 CI,差点超过 limit……

TheNetAdmin avatar Jan 09 '21 22:01 TheNetAdmin