CI #1329
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: devel | |
#- name: nim | |
# version: version-2-0 | |
- 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: nim-works/setup-nimskull@0.1.0 | |
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.bin-path }} | |
- name: Fetch libgit2 | |
uses: actions/checkout@v4 | |
with: | |
path: ci/libgit2 | |
repository: libgit2/libgit2 | |
ref: v1.7.1 | |
- 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 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: Docs | |
if: matrix.compiler.version == 'version-1-6' | |
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: Pages | |
if: > | |
github.event_name == 'push' && github.ref == 'refs/heads/master' && | |
matrix.os == 'ubuntu-latest' && matrix.compiler.version == 'version-1-6' | |
uses: crazy-max/ghaction-github-pages@v1 | |
with: | |
build_dir: ci/docs | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |