Skip to content

Commit

Permalink
add basic CI using github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Nov 12, 2021
1 parent a6f937a commit e745a88
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: scinim CI
on:
push:
paths:
- 'tests/**'
- 'src/**'
- 'scinim.nimble'
- '.github/workflows/ci.yml'
pull_request:
paths:
- 'tests/**'
- 'src/**'
- 'scinim.nimble'
- '.github/workflows/ci.yml'

jobs:
build:
strategy:
fail-fast: false
matrix:
branch: [version-1-4, devel]
target: [linux, macos, windows]
include:
- target: linux
builder: ubuntu-18.04
- target: macos
builder: macos-10.15
- target: windows
builder: windows-2019
name: '${{ matrix.target }} (${{ matrix.branch }})'
runs-on: ${{ matrix.builder }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: scinim

- name: Setup Nim
uses: alaviss/[email protected]
with:
path: nim
version: ${{ matrix.branch }}

- name: Install dependencies (Ubuntu)
if: ${{matrix.target == 'linux'}}
run: |
sudo apt-get update
sudo apt-get install -y python-numpy python3-numpy
- name: Install dependencies (OSX)
if: ${{matrix.target == 'macos'}}
run: |
brew install numpy
- name: Setup MSYS2 (Windows)
if: ${{matrix.target == 'windows'}}
uses: msys2/setup-msys2@v2
with:
path-type: inherit
update: true
install: base-devel git mingw-w64-x86_64-toolchain

- name: Install dependencies (Windows)
if: ${{matrix.target == 'windows'}}
shell: msys2 {0}
run: |
pacman -Syu --noconfirm
pacman -S --needed --noconfirm mingw-w64-x86_64-python-numpy
- name: Setup nimble & deps
shell: bash
run: |
cd scinim
nimble refresh -y
nimble install -y
- name: Run tests (Linux & Mac)
if: ${{matrix.target != 'windows'}}
shell: bash
run: |
cd scinim
nimble test
- name: Run tests (Windows)
if: ${{matrix.target == 'windows'}}
shell: msys2 {0}
run: |
cd scinim
nimble test
- name: Build docs
if: >
github.event_name == 'push' && github.ref == 'refs/heads/master' &&
matrix.target == 'linux' && matrix.branch == 'devel'
shell: bash
run: |
cd scinim
branch=${{ github.ref }}
branch=${branch##*/}
nimble doc --project --path="." --outdir:docs \
'--git.url:https://github.com/${{ github.repository }}' \
'--git.commit:${{ github.sha }}' \
"--git.devel:$branch" \
src/scinim.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.target == 'linux' && matrix.branch == 'devel'
uses: crazy-max/ghaction-github-pages@v1
with:
build_dir: scinim/docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions scinim.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ requires "fusion"
requires "arraymancer >= 0.7.3"
requires "polynumeric >= 0.2.0"
requires "nimpy >= 0.2.0"

task test, "Run all tests":
exec "nim c -r tests/tnumpyarrays.nim"
exec "nim c -r --gc:orc tests/tnumpyarrays.nim"
exec "nim cpp -r tests/tnumpyarrays.nim"
exec "nim cpp -r --gc:orc tests/tnumpyarrays.nim"

0 comments on commit e745a88

Please sign in to comment.