workflows/ci_docs: lots of goodies (#13809)
* workflows/ci_docs: publish documentation to Github Pages This should be a complete replacement for our current Travis CI setup. * workflows/ci_docs: run docgen upon modification to the css on push So that any changes regarding the stylesheets would be reflected on the published docs. * workflows/ci_docs: build the compiler in release mode * workflows/ci_docs: set branch name for the generated docs This makes the "Source" links work correctly. * workflows/ci_docs: run docgen on windows and osx too Only deploy the Linux-generated version. * workflows/ci_docs: cache csources compiler This should cut the time spent building csources, which is about 1-2mins depending on OS.
This commit is contained in:
parent
42d2c3088e
commit
5621ff6d09
1 changed files with 96 additions and 14 deletions
110
.github/workflows/ci_docs.yml
vendored
110
.github/workflows/ci_docs.yml
vendored
|
|
@ -1,36 +1,105 @@
|
||||||
name: Nim Docs CI
|
name: Nim Docs CI
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
# Run only on changes on these files
|
||||||
|
paths:
|
||||||
|
- 'lib/**.nim'
|
||||||
|
- 'doc/**.rst'
|
||||||
|
- 'doc/nimdoc.css'
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
# Run only on changes on these files
|
# Run only on changes on these files
|
||||||
paths:
|
paths:
|
||||||
- 'lib/*.nim'
|
- 'lib/**.nim'
|
||||||
- 'doc/*.rst'
|
- 'doc/**.rst'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: 'Docs builder'
|
strategy:
|
||||||
runs-on: ubuntu-18.04
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: [linux, windows, osx]
|
||||||
|
include:
|
||||||
|
- target: linux
|
||||||
|
os: ubuntu-18.04
|
||||||
|
- target: windows
|
||||||
|
os: windows-2019
|
||||||
|
- target: osx
|
||||||
|
os: macos-10.15
|
||||||
|
|
||||||
|
name: ${{ matrix.target }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout'
|
- name: 'Checkout'
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: 'Checkout csources'
|
- name: 'Install build dependencies (macOS)'
|
||||||
uses: actions/checkout@v2
|
if: runner.os == 'macOS'
|
||||||
with:
|
run: brew install make
|
||||||
repository: nim-lang/csources
|
|
||||||
path: csources
|
- name: 'Install build dependencies (Windows)'
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir dist
|
||||||
|
curl -L https://nim-lang.org/download/mingw64.7z -o dist/mingw64.7z
|
||||||
|
curl -L https://nim-lang.org/download/dlls.zip -o dist/dlls.zip
|
||||||
|
7z x dist/mingw64.7z -odist
|
||||||
|
7z x dist/dlls.zip -obin
|
||||||
|
echo "::add-path::${{ github.workspace }}/dist/mingw64/bin"
|
||||||
|
|
||||||
- name: 'Add build binaries to PATH'
|
- name: 'Add build binaries to PATH'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "::add-path::${{ github.workspace }}/bin"
|
run: echo "::add-path::${{ github.workspace }}/bin"
|
||||||
|
|
||||||
|
- name: 'Get current csources version'
|
||||||
|
id: csources-version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sha=$(git ls-remote https://github.com/nim-lang/csources master | cut -f 1)
|
||||||
|
echo "::set-output name=sha::$sha"
|
||||||
|
|
||||||
|
- name: 'Get prebuilt csources from cache'
|
||||||
|
id: csources-cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: bin
|
||||||
|
key: '${{ matrix.os }}-${{ steps.csources-version.outputs.sha }}'
|
||||||
|
|
||||||
|
- name: 'Checkout csources'
|
||||||
|
if: steps.csources-cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: nim-lang/csources
|
||||||
|
path: csources
|
||||||
|
|
||||||
- name: 'Build 1-stage compiler from csources'
|
- name: 'Build 1-stage compiler from csources'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ncpu=$(nproc)
|
ext=
|
||||||
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
|
[[ '${{ runner.os }}' == 'Windows' ]] && ext=.exe
|
||||||
|
if [[ ! -x bin/nim-csources$ext ]]; then
|
||||||
|
ncpu=
|
||||||
|
case '${{ runner.os }}' in
|
||||||
|
'Linux')
|
||||||
|
ncpu=$(nproc)
|
||||||
|
;;
|
||||||
|
'macOS')
|
||||||
|
ncpu=$(sysctl -n hw.ncpu)
|
||||||
|
;;
|
||||||
|
'Windows')
|
||||||
|
ncpu=$NUMBER_OF_PROCESSORS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
|
||||||
|
|
||||||
make -C csources -j $ncpu CC=gcc ucpu='amd64'
|
make -C csources -j $ncpu CC=gcc
|
||||||
|
cp bin/nim{,-csources}$ext
|
||||||
|
else
|
||||||
|
echo 'Cache hit, using prebuilt csources'
|
||||||
|
cp bin/nim{-csources,}$ext
|
||||||
|
fi
|
||||||
|
|
||||||
- name: 'Build koch'
|
- name: 'Build koch'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
@ -38,8 +107,21 @@ jobs:
|
||||||
|
|
||||||
- name: 'Build the real compiler'
|
- name: 'Build the real compiler'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./koch boot
|
run: ./koch boot -d:release
|
||||||
|
|
||||||
- name: 'Build documentation'
|
- name: 'Build documentation'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: ./koch doc
|
run: ./koch doc --git.commit:devel
|
||||||
|
|
||||||
|
- name: 'Prepare documentation for deployment'
|
||||||
|
if: github.event_name == 'push' && github.ref == 'devel' && matrix.target == 'linux'
|
||||||
|
shell: bash
|
||||||
|
run: cp -f doc/html/{overview,index}.html
|
||||||
|
|
||||||
|
- name: 'Publish documentation to Github Pages'
|
||||||
|
if: github.event_name == 'push' && github.ref == 'devel' && matrix.target == 'linux'
|
||||||
|
uses: crazy-max/ghaction-github-pages@v1
|
||||||
|
with:
|
||||||
|
build-dir: doc/html
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue