Explicitly allow openArray
in Tensor []
, []=
, fix the CI
#491
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: Arraymancer CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
max-parallel: 20 | |
matrix: | |
# branch: [version-1-0, version-1-2, version-1-4, version-1-6] # [devel] | |
nim: ['version-1-6', 'version-2-0', 'devel'] # 'devel' | |
target: | |
- os: linux | |
cpu: amd64 | |
# TODO: https://github.com/mratsim/Arraymancer/issues/511 | |
# - os: linux | |
# cpu: i386 | |
- os: macos | |
cpu: amd64 | |
# TODO: install openblas or lapack | |
# - os: windows | |
# cpu: amd64 | |
# - os: windows | |
# cpu: i386 | |
test_lang: [c] # cpp not configured | |
include: | |
- target: | |
os: linux | |
builder: ubuntu-20.04 | |
shell: bash | |
- target: | |
os: macos | |
builder: macos-11 | |
shell: bash | |
# - target: | |
# os: windows | |
# builder: windows-2019 | |
# shell: msys2 {0} | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.test_lang }} (${{ matrix.nim}})' | |
runs-on: ${{ matrix.builder }} | |
steps: | |
- name: Get branch name | |
shell: bash | |
run: | | |
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then | |
echo "##[set-output name=branch_name;]$(echo ${GITHUB_HEAD_REF})" | |
echo "Branch found (PR): ${GITHUB_HEAD_REF}" | |
else | |
echo "##[set-output name=branch_name;]$(echo ${GITHUB_REF#refs/heads/})" | |
echo "Branch found (not PR): ${GITHUB_REF#refs/heads/}" | |
fi | |
id: get_branch | |
- name: Cancel Previous Runs (except master) | |
if: > | |
steps.get_branch.outputs.branch_name != 'master' | |
uses: styfle/cancel-workflow-action@0.5.0 | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout arraymancer | |
uses: actions/checkout@v2 | |
with: | |
path: arraymancer | |
submodules: true | |
- name: Install build dependencies (Linux i386) | |
if: runner.os == 'Linux' && matrix.target.cpu == 'i386' | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt-fast update -qq | |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ | |
--no-install-recommends -yq gcc-multilib g++-multilib \ | |
libssl-dev:i386 | |
mkdir -p external/bin | |
cat << EOF > external/bin/gcc | |
#!/bin/bash | |
exec $(which gcc) -m32 "\$@" | |
EOF | |
cat << EOF > external/bin/g++ | |
#!/bin/bash | |
exec $(which g++) -m32 "\$@" | |
EOF | |
chmod 755 external/bin/gcc external/bin/g++ | |
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH | |
- name: MSYS2 (Windows i386) | |
if: runner.os == 'Windows' && matrix.target.cpu == 'i386' | |
uses: msys2/setup-msys2@v2 | |
with: | |
path-type: inherit | |
msystem: MINGW32 | |
# update: true | |
install: >- | |
base-devel | |
git | |
mingw-w64-i686-toolchain | |
- name: MSYS2 (Windows amd64) | |
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' | |
uses: msys2/setup-msys2@v2 | |
with: | |
path-type: inherit | |
# update: true | |
install: >- | |
base-devel | |
git | |
mingw-w64-x86_64-toolchain | |
- name: Restore Nim DLLs dependencies (Windows) from cache | |
if: runner.os == 'Windows' | |
id: windows-dlls-cache | |
uses: actions/cache@v2 | |
with: | |
path: external/dlls | |
key: 'dlls' | |
- name: Install DLL dependencies (Windows) | |
if: > | |
steps.windows-dlls-cache.outputs.cache-hit != 'true' && | |
runner.os == 'Windows' | |
run: | | |
mkdir external | |
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip | |
7z x external/windeps.zip -oexternal/dlls | |
- name: Path to cached dependencies (Windows) | |
if: > | |
runner.os == 'Windows' | |
run: | | |
echo '${{ github.workspace }}'"/external/dlls" >> $GITHUB_PATH | |
- name: Derive environment variables | |
run: | | |
if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then | |
PLATFORM=x64 | |
else | |
PLATFORM=x86 | |
fi | |
echo "PLATFORM=${PLATFORM}" >> $GITHUB_ENV | |
if [[ '${{ matrix.target.os }}' == 'windows' ]]; then | |
MAKE_CMD="mingw32-make" | |
else | |
MAKE_CMD="make" | |
fi | |
echo "MAKE_CMD=$MAKE_CMD" >> $GITHUB_ENV | |
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 | |
echo "ncpu=${ncpu}" >> $GITHUB_ENV | |
- uses: alaviss/setup-nim@0.1.1 | |
with: | |
path: 'nim' | |
version: ${{ matrix.nim }} | |
- name: Install dependencies (Linux 32-bit) | |
if: runner.os == 'Linux' && matrix.target.cpu == 'i386' | |
run: | | |
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \ | |
--no-install-recommends -yq \ | |
libopenblas-dev:i386 | |
# Apple Accelerate installed by default | |
# - name: Install dependencies (macOS) | |
# if: runner.os == 'macOS' | |
# run: brew install openblas | |
- name: Install dependencies (Windows) | |
if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' | |
shell: msys2 {0} | |
run: | | |
pacman -S --needed --noconfirm mingw-w64-x86_64-lapack | |
- name: Install dependencies (Windows) | |
if: runner.os == 'Windows' && matrix.target.cpu == 'i386' | |
shell: msys2 {0} | |
run: | | |
pacman -S --needed --noconfirm mingw-w64-i686-lapack | |
- name: Restore datasets cache | |
id: datasets-cache | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cache/arraymancer | |
key: 'datasets' | |
- name: Run Arraymancer tests | |
working-directory: arraymancer | |
run: | | |
export ARRAYMANCER_TEST_LANG=${{ matrix.test_lang }} | |
nimble install -y --depsOnly | |
# Run the tests. | |
nimble test | |
- name: Run Arraymancer tests with ORC | |
working-directory: arraymancer | |
run: | | |
export ARRAYMANCER_TEST_LANG=${{ matrix.test_lang }} | |
nimble install -y --depsOnly | |
# Run the tests. | |
nimble test_orc_release | |
- name: Build docs | |
if: > | |
github.event_name == 'push' && github.ref == 'refs/heads/master' && | |
matrix.target.os == 'linux' && matrix.nim == 'version-2-0' | |
shell: bash | |
run: | | |
cd arraymancer | |
# need to call `develop`, otherwise `docs.nim` logic breaks | |
nimble install -y nimhdf5 | |
nimble develop -y | |
nimble gen_docs | |
cp docs/build/{the,}index.html || true | |
- name: Publish docs | |
if: > | |
github.event_name == 'push' && github.ref == 'refs/heads/master' && | |
matrix.target.os == 'linux' && matrix.nim == 'version-2-0' | |
uses: crazy-max/ghaction-github-pages@v1 | |
with: | |
build_dir: arraymancer/docs/build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |