summary refs log tree commit diff stats
path: root/.github/workflows/ci_docs.yml
blob: ddef94fbe5093bac53fee97e7aeab53798d5bd21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Nim Docs CI
on:
  push:
    paths:
      - 'compiler/docgen.nim'
      - 'compiler/renderverbatim.nim'
      - 'config/nimdoc.cfg'
      - 'doc/**.rst'
      - 'doc/nimdoc.css'
      - 'lib/**.nim'
      - 'nimdoc/testproject/expected/testproject.html'
      - 'tools/dochack/dochack.nim'
      - 'tools/kochdocs.nim'
      - '.github/workflows/ci_docs.yml'
      - 'koch.nim'
  pull_request:
    # Run only on changes on these files.
    paths:
      - 'compiler/docgen.nim'
      - 'compiler/renderverbatim.nim'
      - 'config/nimdoc.cfg'
      - 'doc/**.rst'
      - 'doc/nimdoc.css'
      - 'lib/**.nim'
      - 'nimdoc/testproject/expected/testproject.html'
      - 'tools/dochack/dochack.nim'
      - 'tools/kochdocs.nim'
      - '.github/workflows/ci_docs.yml'
      - 'koch.nim'

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        target: [linux, windows, osx]
        include:
          - target: linux
            os: ubuntu-20.04
          - target: windows
            os: windows-2019
          - target: osx
            os: macos-10.15

    name: ${{ matrix.target }}
    runs-on: ${{ matrix.os }}

    steps:
      - name: 'Checkout'
        uses: actions/checkout@v2
        with:
          fetch-depth: 2

      - name: 'Install build dependencies (macOS)'
        if: runner.os == 'macOS'
        run: brew install make

      - name: 'Install build dependencies (Windows)'
        if: runner.os == 'Windows'
        shell: bash
        run: |
          set -e
          . ci/funs.sh
          nimInternalInstallDepsWindows
          echo "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}"

      - name: 'Add build binaries to PATH'
        shell: bash
        run: echo "${{ github.workspace }}/bin" >> "${GITHUB_PATH}"

      - name: 'System information'
        shell: bash
        run: . ci/funs.sh && nimCiSystemInfo

      - name: 'Build csourcesAny (posix)'
        # this would work on windows and other CI use this on windows,
        # but we ensure here that `ci/build_autogen.bat` keeps working on windows.
        if: runner.os != 'Windows'
        shell: bash
        run: . ci/funs.sh && nimBuildCsourcesIfNeeded CC=gcc
          # was previously using caching via `actions/cache@v1` but this wasn't
          # used in other CI pipelines and it's unclear the added complexity
          # was worth the saving; can be revisited if needed.

      - name: 'Build csourcesAny (windows)'
        if: runner.os == 'Windows'
        shell: cmd
        run: ci/build_autogen.bat

      - name: 'Build koch'
        shell: bash
        run: nim c koch

      - name: 'Build the real compiler'
        shell: bash
        run: ./koch boot -d:release

      - name: 'Build documentation'
        shell: bash
        run: ./koch doc --git.commit:devel

      - name: 'Publish documentation to Github Pages'
        if: |
          github.event_name == 'push' && github.ref == 'refs/heads/devel' &&
          matrix.target == 'linux'
        uses: crazy-max/ghaction-github-pages@v1
        with:
          build_dir: doc/html
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}