PR #782
This file contains hidden or 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: PR | |
| on: | |
| # run on pull_request events that target the master branch | |
| pull_request: | |
| branches: | |
| - master | |
| # run on push events to the master branch | |
| push: | |
| branches: | |
| - master | |
| # run every day of the week at 02:00 | |
| schedule: | |
| - cron: 0 2 * * * | |
| jobs: | |
| build: | |
| name: Building on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| #max-parallel: 4 | |
| matrix: | |
| python-version: [3.13.x] | |
| # https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} for PR | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Versions | |
| run: | | |
| python --version | |
| cmake --version | |
| c++ --version | |
| # - name: Install gcc-8 | |
| # if: matrix.os == 'ubuntu-18.04' | |
| # env: | |
| # CC: gcc-8 | |
| # CXX: g++-8 | |
| # run: | | |
| # sudo apt-get update | |
| # sudo apt-get -y install gcc-8 g++-8 | |
| # sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 \ | |
| # 100 \ | |
| # --slave /usr/bin/g++ g++ /usr/bin/g++-8 \ | |
| # --slave /usr/bin/gcov gcov /usr/bin/gcov-8 \ | |
| # --slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-8 \ | |
| # --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-8 \ | |
| # --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-8 \ | |
| # --slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-8 \ | |
| # --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-8 | |
| # sudo update-alternatives --install /usr/bin/cpp cpp-bin /usr/bin/cpp-8 100 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install setuptools wheel | |
| - name: Setup venv and build htmcore (Linux & macOS) | |
| if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
| run: | | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| python htm_install.py | |
| - name: Setup venv and build htmcore (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| python -m venv .venv | |
| .venv\Scripts\python.exe htm_install.py | |
| - name: C++ & Python Tests (Linux & macOS) | |
| if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | |
| run: | | |
| source .venv/bin/activate | |
| python htm_test.py | |
| - name: C++ & Python Tests (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| .venv\Scripts\activate.bat | |
| .venv\Scripts\python.exe htm_test.py | |
| - name: Memory leaks check (valgrind) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get -y install valgrind | |
| LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/build/Release/lib valgrind --show-leak-kinds=definite,indirect,possible,reachable --track-origins=yes --num-callers=40 --error-exitcode=3 ./build/Release/bin/hello 5 || exit 1 | |
| - name: MNIST example | |
| run: ./build/Release/bin/mnist_sp 100 || exit 2 | |
| - name: NetworkAPI example | |
| run: ./build/Release/bin/napi_hello 1000 || exit 3 | |
| - name: Hello example (dynamically linked) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/build/Release/lib ./build/Release/bin/dynamic_hello 1000 || exit 4 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: htm-core-${{ matrix.os }}-py-${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }} | |
| path: dist/*.whl |