Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多平台CI #83

Open
TheNetAdmin opened this issue Oct 25, 2020 · 6 comments
Open

多平台CI #83

TheNetAdmin opened this issue Oct 25, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@TheNetAdmin
Copy link
Owner

可改进的内容

现在的 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 TheNetAdmin added the enhancement New feature or request label Oct 25, 2020
@TheNetAdmin
Copy link
Owner Author

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

macos-ci.log

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

@TheNetAdmin
Copy link
Owner Author

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

    - 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
Copy link
Owner Author

如下代码可以用于在 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
Copy link
Owner Author

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

@TheNetAdmin TheNetAdmin reopened this Jan 9, 2021
@muzimuzhi
Copy link

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

About billing for GitHub Actions

Usage limits

@TheNetAdmin
Copy link
Owner Author

About billing for GitHub Actions

Usage limits

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants