mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
* support skip ci in azure pipelines * [skip ci] example of a commit that skips CI * example of a commit that does not skip CI * fix github actions logic for ci skip handling * [skip ci] example of a commit that skips CI for all pipelines * example of a commit that does not skip CI for any pipeline
153 lines
4.3 KiB
YAML
153 lines
4.3 KiB
YAML
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:
|
|
# see D20210329T004830
|
|
if: |
|
|
!contains(format('{0}', github.event.pull_request.title), '[skip ci]')
|
|
strategy:
|
|
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:
|
|
- name: 'Checkout'
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: 'Check whether to skip CI'
|
|
shell: bash
|
|
run: |
|
|
# see D20210329T004830
|
|
commitMsg=$(git log --no-merges -1 --pretty=format:"%s")
|
|
echo commitMsg: $commitMsg
|
|
echo $commitMsg | grep -v '\[skip ci\]'
|
|
|
|
- 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: |
|
|
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 "${{ github.workspace }}/dist/mingw64/bin" >> "${GITHUB_PATH}"
|
|
|
|
- name: 'Add build binaries to PATH'
|
|
shell: bash
|
|
run: echo "${{ github.workspace }}/bin" >> "${GITHUB_PATH}"
|
|
|
|
- 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'
|
|
shell: bash
|
|
run: |
|
|
ext=
|
|
[[ '${{ 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
|
|
cp bin/nim{,-csources}$ext
|
|
else
|
|
echo 'Cache hit, using prebuilt csources'
|
|
cp bin/nim{-csources,}$ext
|
|
fi
|
|
|
|
- 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 }}
|