diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..96d7e05 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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/setup-nim@0.1.1 + 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 }} diff --git a/scinim.nimble b/scinim.nimble index ec694d0..cc313d2 100644 --- a/scinim.nimble +++ b/scinim.nimble @@ -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"