<NME> CI.yml
<BEF> name: CI
on:
  push:
    branches:
      - master
      - release-*
    tags: '*'
  pull_request:
jobs:
  test:
    name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        version:
          - '1.6'
          - '1'
          - 'nightly'
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
        arch:
          - x64
        include:
          - os: ubuntu-latest
            version: '1'
            arch: x86
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: ${{ matrix.version }}
          arch: ${{ matrix.arch }}
          show-versioninfo: true
      - uses: julia-actions/cache@v1
      - uses: julia-actions/julia-buildpkg@v1
      - uses: julia-actions/julia-runtest@v1
      - uses: julia-actions/julia-processcoverage@v1
      - uses: codecov/codecov-action@v1
        with:
          file: lcov.info

  latex:
    name: "PDF/LaTeX backend"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: '1'
      - uses: julia-actions/cache@v1
      - run: |
          julia --project=test/examples -e '
            using Pkg
            Pkg.instantiate()
            Pkg.develop(PackageSpec(path=pwd()))
            Pkg.add(["IOCapture", "tectonic_jll"])'
      - run: julia --project=test/examples --code-coverage test/examples/tests_latex.jl
      - uses: julia-actions/julia-processcoverage@v1
      - uses: codecov/codecov-action@v1
        with:
          file: lcov.info
      - uses: actions/upload-artifact@v3
        with:
          name: PDFs
          path: test/examples/builds/*/*.pdf

  themes:
    name: "CSS for HTML themes"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: '1'
      - uses: julia-actions/cache@v1
      - name: Install dependencies
        run: julia --color=yes --project=test/themes/ docs/instantiate.jl test/themes/
      - name: Verify theme CSS files
        run: julia --project=test/themes test/themes/themes.jl

  prerender:
    name: "NodeJS for prerender"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: '1'
      - uses: julia-actions/cache@v1
      - run: |
          julia --project=test/prerender/ -e '
            using Pkg
            Pkg.instantiate()
            Pkg.develop(PackageSpec(path=pwd()))'
      - run: julia --color=yes --project=test/prerender --code-coverage test/prerender/prerender.jl
      - uses: julia-actions/julia-processcoverage@v1
      - uses: codecov/codecov-action@v1
        with:
          file: lcov.info

  docs:
    name: 'Documentation: ${{ matrix.format }}'
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        format:
          - html
          - pdf
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@v1
        with:
          version: '1'
      - uses: julia-actions/cache@v1
      - name: Install dependencies
        run: julia --color=yes --project=docs/ docs/instantiate.jl
      - name: Build the manual
        run: julia --color=yes --project=docs/ docs/make.jl ${{ matrix.format }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
          DOCUMENTER_LATEX_DEBUG: ${{ github.workspace }}/latex-debug-logs
      - uses: actions/upload-artifact@v3
        if: ${{ always() && matrix.format == 'pdf' }}
        with:
          name: PDF build logs
          path: ${{ github.workspace }}/latex-debug-logs

  linkcheck:
    name: "Linkcheck: online tests"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@latest
        with:
          version: '1.6'
      - name: Run online linkcheck tests
        run: julia --color=yes test/run_docchecks.jl

  linkcheck-manual:
    name: "Linkcheck: Documenter manual"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@latest
        with:
          version: '1.6'
      - name: Install dependencies
        run: julia --color=yes --project=docs/ docs/instantiate.jl
      - name: Build and check documentation
        run: julia --color=yes --project=docs/ docs/make.jl linkcheck

  changelog:
    name: "Verify CHANGELOG"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: julia-actions/setup-julia@latest
        with:
          version: '1.6'
      - name: Install dependencies
        run: julia --color=yes --project=scripts/ -e 'using Pkg; Pkg.instantiate()'
      - name: Test scripts/changelog.jl
        run: |
          # Run the unit tests of the changelog.jl script:
          julia --color=yes --code-coverage --project=scripts/ scripts/changelog.jl test
          # Run changelog.jl with a small, but known good CHANGELOG file and make sure it passes:
          julia --color=yes --code-coverage --project=scripts/ scripts/changelog.jl --file=scripts/changelog-valid.md
          # Run changelog.jl with a known _bad_ CHANGELOG file, which should exit with a non-zero code:
          ! julia --color=yes --code-coverage --project=scripts/ scripts/changelog.jl --file=scripts/changelog-invalid.md
      - name: Check CHANGELOG.md
        run: julia --color=yes --code-coverage --project=scripts/ scripts/changelog.jl --github
      - uses: julia-actions/julia-processcoverage@v1
        with:
          directories: src,scripts
      - uses: codecov/codecov-action@v1
        with:
          file: lcov.info

<MSG> ci: run in runci/* branches

This makes it easier to run CI on user branches, which is useful when
pushing to master without the noise of a pull request, but where it
would still be a good idea to run CI on the changes before adding the
commits to the master branch. Having these special runci/* branches
available in the CI settings means that it is not necessary to e.g.
cherry pick some commits or make temporary edits to enable CI on a user
branch (we still want to avoid CI on most branches, since most changes
will be merged via PRs).

<DFF> @@ -4,6 +4,7 @@ on:
     branches:
       - master
       - release-*
+      - runci/*
     tags: '*'
   pull_request:
 jobs:

ci: run in runci/* branches