2022-03-28 18:42:45 -06:00
|
|
|
name: Tests
|
|
|
|
|
|
|
|
on: [pull_request, push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
|
|
|
env:
|
|
|
|
NPROC: 2
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
cache_nonce: [ 1 ]
|
2022-06-17 22:04:41 -05:00
|
|
|
nim_version: [ 1.2.18, 1.4.8, 1.6.6 ]
|
2022-03-28 18:42:45 -06:00
|
|
|
platform:
|
|
|
|
- {
|
|
|
|
icon: 🐧,
|
|
|
|
label: Linux,
|
|
|
|
os: ubuntu,
|
|
|
|
shell: bash --noprofile --norc -eo pipefail
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
icon: 🍎,
|
|
|
|
label: macOS,
|
|
|
|
os: macos,
|
|
|
|
shell: bash --noprofile --norc -eo pipefail
|
|
|
|
}
|
|
|
|
- {
|
|
|
|
icon: 🏁,
|
|
|
|
label: Windows,
|
|
|
|
os: windows,
|
|
|
|
shell: msys2
|
|
|
|
}
|
|
|
|
name: ${{ matrix.platform.icon }} ${{ matrix.platform.label }} - Nim v${{ matrix.nim_version }}
|
|
|
|
runs-on: ${{ matrix.platform.os }}-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: ${{ matrix.platform.shell }} {0}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# - name: Install tools and libraries via APT (Linux)
|
|
|
|
# if: matrix.platform.os == 'ubuntu'
|
|
|
|
# run: |
|
|
|
|
# sudo apt update
|
|
|
|
# sudo apt install -y \
|
|
|
|
# ...
|
|
|
|
|
|
|
|
- name: Install tools and libraries via Homebrew (macOS)
|
|
|
|
if: matrix.platform.os == 'macos'
|
|
|
|
run: |
|
|
|
|
brew update
|
|
|
|
brew install \
|
|
|
|
findutils \
|
|
|
|
libomp
|
|
|
|
|
|
|
|
- name: Install tools and libraries via MSYS2 (Windows)
|
|
|
|
if: matrix.platform.os == 'windows'
|
|
|
|
uses: msys2/setup-msys2@v2
|
|
|
|
with:
|
|
|
|
msystem: UCRT64
|
|
|
|
install: >
|
|
|
|
base-devel
|
|
|
|
git
|
|
|
|
mingw-w64-ucrt-x86_64-cmake
|
|
|
|
mingw-w64-ucrt-x86_64-toolchain
|
|
|
|
|
|
|
|
- name: Checkout sources from GitHub
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
|
|
|
- name: Calculate cache member paths
|
|
|
|
id: calc-paths
|
|
|
|
run: |
|
|
|
|
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
|
|
echo "::set-output name=bash_env::$(cygpath -m "${HOME}")/.bash_env"
|
|
|
|
echo "::set-output name=choosenim::$(cygpath -m "${USERPROFILE}")/.choosenim"
|
|
|
|
echo "::set-output name=nimble::$(cygpath -m "${HOME}")/.nimble"
|
|
|
|
else
|
|
|
|
echo "::set-output name=bash_env::${HOME}/.bash_env"
|
|
|
|
echo "::set-output name=choosenim::${HOME}/.choosenim"
|
|
|
|
echo "::set-output name=nimble::${HOME}/.nimble"
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Restore choosenim and Nim tooling from cache
|
|
|
|
id: choosenim-nim-tooling-cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
${{ steps.calc-paths.outputs.bash_env }}
|
|
|
|
${{ steps.calc-paths.outputs.choosenim }}
|
|
|
|
${{ steps.calc-paths.outputs.nimble }}/bin
|
|
|
|
key: ${{ matrix.platform.os }}-nim_version:${{ matrix.nim_version }}-cache_nonce:${{ matrix.cache_nonce }}
|
|
|
|
|
|
|
|
- name: Install choosenim and Nim tooling
|
|
|
|
if: steps.choosenim-nim-tooling-cache.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
mkdir -p "${HOME}/Downloads"
|
|
|
|
cd "${HOME}/Downloads"
|
|
|
|
curl https://nim-lang.org/choosenim/init.sh -sSf -O
|
|
|
|
chmod +x init.sh
|
|
|
|
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
|
|
mkdir -p "$(cygpath "${USERPROFILE}")/.nimble/bin"
|
|
|
|
fi
|
|
|
|
CHOOSENIM_CHOOSE_VERSION=${{ matrix.nim_version }} ./init.sh -y
|
|
|
|
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
|
|
mv "$(cygpath "${USERPROFILE}")/.nimble" "${HOME}/"
|
|
|
|
# intention is to rely only on libs provided by the OS and MSYS2 env
|
|
|
|
rm -rf "${HOME}/.nimble/bin/"*.dll
|
|
|
|
rm -rf "${HOME}/.nimble/bin/"*.pem
|
|
|
|
fi
|
|
|
|
echo 'export NIMBLE_DIR="${HOME}/.nimble"' >> "${HOME}/.bash_env"
|
|
|
|
echo 'export PATH="${NIMBLE_DIR}/bin:${PATH}"' >> "${HOME}/.bash_env"
|
|
|
|
|
|
|
|
- name: Install project dependencies
|
|
|
|
run: |
|
|
|
|
source "${HOME}/.bash_env"
|
|
|
|
cd "${NIMBLE_DIR}/bin"
|
|
|
|
# delete broken symlinks, which can arise because e.g. the cache
|
|
|
|
# restored a symlink that points to an executable within
|
|
|
|
# ../pkgs/foo-1.2.3/ but the project's .nimble file has been updated
|
|
|
|
# to install foo-#head; in the case of a broken symlink, nimble's
|
|
|
|
# auto-overwrite fails
|
|
|
|
if [[ ${{ matrix.platform.os }} = macos ]]; then
|
|
|
|
gfind . -xtype l -delete
|
|
|
|
else
|
|
|
|
find . -xtype l -delete
|
|
|
|
fi
|
|
|
|
cd -
|
|
|
|
nimble --accept install
|
|
|
|
|
|
|
|
- name: Build and run tests
|
|
|
|
run: |
|
|
|
|
source "${HOME}/.bash_env"
|
|
|
|
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
|
|
touch tests/testleopard.exe
|
|
|
|
else
|
|
|
|
touch tests/testleopard
|
|
|
|
fi
|
|
|
|
if [[ ${{ matrix.platform.os }} = macos ]]; then
|
2022-11-14 10:55:07 +01:00
|
|
|
export PATH="$(brew --prefix llvm@14)/bin:${PATH}"
|
|
|
|
export LDFLAGS="-L$(brew --prefix libomp)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib"
|
|
|
|
compiler_extra_options="-d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$(brew --prefix llvm@14)/bin/clang -DCMAKE_CXX_COMPILER=$(brew --prefix llvm@14)/bin/clang++' -d:LeopardExtraCompilerlags='-fopenmp' -d:LeopardExtraLinkerFlags='-fopenmp -L$(brew --prefix libomp)/lib'"
|
2022-06-17 22:04:41 -05:00
|
|
|
fi
|
|
|
|
if [[ ${{ matrix.nim_version }} = 1.2.* ]]; then
|
|
|
|
eval nimble --verbose test -d:release --gc:refc ${compiler_extra_options}
|
|
|
|
elif [[ ${{ matrix.nim_version }} = 1.4.* ]]; then
|
|
|
|
eval nimble --verbose test -d:release --gc:refc ${compiler_extra_options}
|
|
|
|
eval nimble --verbose test -d:release --gc:orc ${compiler_extra_options}
|
2022-03-28 18:42:45 -06:00
|
|
|
else
|
2022-06-17 22:04:41 -05:00
|
|
|
eval nimble --verbose test -d:release --mm:refc ${compiler_extra_options}
|
|
|
|
eval nimble --verbose test -d:release --mm:orc ${compiler_extra_options}
|
2022-03-28 18:42:45 -06:00
|
|
|
fi
|
|
|
|
if [[ ${{ matrix.platform.os }} = macos ]]; then
|
|
|
|
echo
|
|
|
|
echo otool -L tests/testleopard
|
|
|
|
otool -L tests/testleopard
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
echo ldd tests/testleopard
|
|
|
|
ldd tests/testleopard
|
|
|
|
fi
|