Revert change from omp critical section to atomic write, because Wind… #224
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: "CI tests" | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'dependencies/**' | |
- 'include/**' | |
- 'javaio/**' | |
- 'pydip/**' | |
- 'src/**' | |
- 'viewer/**' | |
- 'CMakeLists.txt' | |
- '!**/README*' | |
- '!**/readme*' | |
- '.github/workflows/cmake.yml' | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'dependencies/**' | |
- 'include/**' | |
- 'javaio/**' | |
- 'pydip/**' | |
- 'src/**' | |
- 'viewer/**' | |
- 'CMakeLists.txt' | |
- '!**/README*' | |
- '!**/readme*' | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
n_cores: 4 | |
wheel_location: pydip/staging/dist | |
- os: ubuntu-22.04 # cross-compile 32-bit -- TEMPORARILY SET TO 22.04 because LATEST is now 24.04, with GCC-13, which is broken for 32-bit compilation | |
cross_compile: true | |
n_cores: 4 | |
dip_cmake_opts: -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" -DDIP_BUILD_DIPVIEWER=Off -DDIP_BUILD_JAVAIO=Off -DDIP_BUILD_PYDIP=Off | |
# currently only building DIPlib, as we can't install 32-bit Python, GLUT, etc. | |
wheel_location: pydip/staging/dist | |
- os: macos-latest | |
n_cores: 3 | |
dip_cmake_opts: -DCMAKE_CXX_FLAGS="-I/opt/homebrew/opt/libomp/include -L/opt/homebrew/opt/libomp/lib" | |
wheel_location: pydip/staging/dist | |
- os: windows-latest | |
n_cores: 4 | |
dip_cmake_opts: -A x64 -DDIP_ENABLE_UNICODE=Off -DGLFW_INCLUDE_DIR="glfw-3.3.5.bin.WIN64/include" -DGLFW_LIBRARY="glfw-3.3.5.bin.WIN64/lib-vc2019/glfw3.lib" -DDIP_FIND_FREEGLUT=Off | |
# Windows build must be 64-bit. We're also disabling Unicode because otherwise some tests fail. | |
wheel_location: pydip/Release/staging/dist | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
# Install libraries and Python packages we need | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update | |
sudo apt-get -y install freeglut3-dev | |
python3 -m pip install setuptools wheel build numpy | |
elif [ "$RUNNER_OS" == "Windows" ]; then | |
choco install openjdk8 --no-progress --yes | |
python -m pip install setuptools wheel build numpy wget | |
python -m wget https://github.com/glfw/glfw/releases/download/3.3.5/glfw-3.3.5.bin.WIN64.zip | |
python -c "import zipfile; zip = zipfile.ZipFile('glfw-3.3.5.bin.WIN64.zip', 'r'); zip.extractall()" | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
brew install libomp glfw | |
python3 -m pip install --break-system-packages setuptools wheel build numpy | |
fi | |
shell: bash | |
- name: Install cross-compiler | |
if: matrix.cross_compile | |
run: | | |
sudo apt-get install gcc-multilib g++-multilib | |
- name: Configure | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
python_executable=`which python` | |
else | |
python_executable=`which python3` | |
fi | |
cmake -B '${{github.workspace}}/build' -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{matrix.dip_cmake_opts}} -DDIP_ENABLE_ASSERT=ON -DDIP_PYDIP_WHEEL_INCLUDE_LIBS=ON -DPython_EXECUTABLE=$python_executable | |
shell: bash | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel ${{matrix.n_cores}} | |
- name: Test | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target check | |
- name: Package | |
# Create the Python distribution wheel | |
if: ${{ ! matrix.cross_compile }} | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target bdist_wheel | |
- name: Archive | |
# Store the Python distribution wheel | |
if: ${{ ! matrix.cross_compile }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Python-wheel-${{matrix.os}} | |
path: ${{github.workspace}}/build/${{matrix.wheel_location}}/*.whl |