Skip to content

CI

CI #1240

Workflow file for this run

name: CI
on:
schedule:
- cron: '30 5 * * *'
push:
branches:
- master
paths:
- '**.cfg'
- '**.nims'
- '**.nim'
- '**.nimble'
- '**.sh'
- 'tests/**'
- '.github/workflows/ci.yml'
pull_request:
branches:
- '*'
paths:
- '**.cfg'
- '**.nims'
- '**.nim'
- '**.nimble'
- '**.sh'
- 'tests/**'
- '.github/workflows/ci.yml'
jobs:
build:
strategy:
fail-fast: false
matrix:
#os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
#os: ['macos-latest', 'ubuntu-latest']
os: ['ubuntu-latest']
compiler:
- name: nim
version: version-1-6
- name: nim
version: version-1-4
- name: nim
version: version-1-2
- name: nimskull
version: '^0.1.0-dev.21080'
name: '${{ matrix.os }} (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ci
fetch-depth: 0
# nimph will scream when this is used
#filter: tree:0
- if: matrix.compiler.name == 'nim'
name: Setup Nim
uses: alaviss/setup-nim@0.1.1
with:
path: nim
version: ${{ matrix.compiler.version }}
- if: matrix.compiler.name == 'nimskull'
id: nimskull
name: Setup Nimskull
uses: alaviss/setup-nimskull@f6e8ade8ac51191024616216e5da0ee968d9da48
with:
nimskull-version: ${{ matrix.compiler.version }}
- if: matrix.compiler.name == 'nimskull'
name: Fetch nimble's fork for nimskull
uses: actions/checkout@v4
with:
path: nimble
repository: alaviss/nimble
ref: nimskull
- if: matrix.compiler.name == 'nimskull'
name: Build nimble and add to PATH
shell: bash
run: |
cd nimble
nim c -d:release -o:nimble src/nimble.nim
cp nimble "$NIMSKULL_BIN/nimble"
env:
NIMSKULL_BIN: ${{ steps.nimskull.outputs.binPath }}
- name: Fetch libgit2
uses: actions/checkout@v4
with:
path: ci/libgit2
repository: libgit2/libgit2
ref: v1.5.0
- name: Setup libgit2
shell: bash
run: |
cd ci/libgit2
mkdir build
cd build
cmake ..
cmake --build . -- --quiet
- name: Run tests
shell: bash
run: |
mkdir $HOME/.nimble
cd ci
cp ci-bootstrap.cfg nim.cfg
./bootstrap-nonimble.sh
./nimph refresh
./nimph
./nimph doctor || true
cat nim.cfg
./nimph
./nimph doctor || true
cat nim.cfg
cd `./nimph path balls`
nim c --out:$HOME/balls --define:release balls.nim
cd -
echo "remove nim's config.nims...?"
ls -l `dirname \`which nim\``/../config/
rm `dirname \`which nim\``/../config/config.nims || true
soExt=
case "$RUNNER_OS" in
macOS)
soExt=dylib
;;
Linux)
soExt=so
esac
libgit2Lib=$(pwd)/libgit2/build/libgit2.$soExt
nim c --define:libgit2Lib="$libgit2Lib" --passC:"-I$(pwd)/libgit2/include" --define:ssl -r tests/test.nim
nim c --define:libgit2Lib="$libgit2Lib" --passC:"-I$(pwd)/libgit2/include" --define:ssl --define:release -r tests/test.nim
- name: Build docs
if: ${{ matrix.docs }} == 'true'
shell: bash
run: |
cd ci
branch=${{ github.ref }}
branch=${branch##*/}
mv ci-docs.cfg nim.cfg
rm -rf deps
mkdir deps
./nimph doctor || true
cat nim.cfg
nim doc --project --outdir:docs \
'--git.url:https://github.com/${{ github.repository }}' \
'--git.commit:${{ github.sha }}' \
"--git.devel:$branch" \
src/nimph.nim
# Ignore failures for older Nim
cp docs/{the,}index.html || true
- name: Publish docs
if: >
github.event_name == 'push' && github.ref == 'refs/heads/master' &&
matrix.os == 'ubuntu-latest' && matrix.nim == 'version-1-6'
uses: crazy-max/ghaction-github-pages@v1
with:
build_dir: ci/docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}