Skip to content

Commit

Permalink
Merge pull request #2478 from quentin/macos14
Browse files Browse the repository at this point in the history
Add CI job for Apple ARM
  • Loading branch information
quentin authored Mar 17, 2024
2 parents d3661e5 + eaff312 commit 6473787
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/actions/cmake-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
using: "composite"
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: setup-env
run: |
Expand Down
45 changes: 39 additions & 6 deletions .github/workflows/CI-Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand All @@ -31,7 +31,7 @@ jobs:
chunks: ${{ steps.set-test-ids.outputs.chunks }}
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- id: set-test-ids
uses: ./.github/actions/set-test-ids
with:
Expand All @@ -54,7 +54,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install-lcov
if: ${{ matrix.domain == '32bit' }}
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
xcode-version: '13.4'

- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install-deps
run: sh/setup/install_macos_deps.sh
Expand All @@ -135,6 +135,39 @@ jobs:
n-chunks: ${{ needs.Test-Setup.outputs.n-chunks }}
chunk: ${{ matrix.chunk }}

AppleM-CMake:
needs: Test-Setup
timeout-minutes: 150

name: AppleM-CMake (chunk ${{ matrix.chunk }})

strategy:
fail-fast: false
matrix:
chunk: ${{ fromJSON(needs.Test-Setup.outputs.chunks) }}

runs-on: macos-14

steps:
- name: Select XCode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2'

- name: checkout
uses: actions/checkout@v4

- name: install-deps
run: sh/setup/install_macos_arm_deps.sh

- name: cmake-test-64bit
uses: ./.github/actions/cmake-test
with:
# disable openmp on ARM architecture, see souffle-lang/souffle#2476
cmake-flags: -DSOUFFLE_DOMAIN_64BIT=ON -DSOUFFLE_USE_OPENMP=OFF
n-chunks: ${{ needs.Test-Setup.outputs.n-chunks }}
chunk: ${{ matrix.chunk }}

Memory-Check:
needs: Test-Setup
timeout-minutes: 150
Expand All @@ -150,7 +183,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: install-deps
run: sudo sh/setup/install_ubuntu_deps.sh
Expand All @@ -170,7 +203,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/VS-CI-Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
Windows-CMake-MSVC:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Dependencies Cache
uses: actions/cache@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/create-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
clean: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/populate-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'recursive'

Expand Down
21 changes: 21 additions & 0 deletions sh/setup/install_macos_arm_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Install MACOS dependencies on a Github Action VM

# Enable debugging and logging of shell operations
# that are executed.
set -e
set -x

# Install requirements of MAC OS X
brew install libtool mcpp swig bison libffi
brew install gcc@13
brew link gcc@13

echo "/usr/local/opt/bison/bin:$PATH" >> $GITHUB_PATH
echo 'PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig/"' >> $GITHUB_ENV
echo 'CC=gcc-13' >> $GITHUB_ENV
echo 'CXX=g++-13' >> $GITHUB_ENV

set +e
set +x
17 changes: 15 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,16 @@ if (MSVC)
target_compile_definitions(souffleprof PUBLIC USE_CUSTOM_GETOPTLONG)
endif (MSVC)


if (APPLE)
if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
# work around a known issue with xcode15 linker
# c++ exceptions handling is broken otherwise
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-ld_classic")
target_link_options(libsouffle PUBLIC "-ld_classic")
target_link_options(compiled PUBLIC "-ld_classic")
target_link_options(souffleprof PUBLIC "-ld_classic")
endif()
endif()

# --------------------------------------------------
# Substitutions for souffle-compile.py
Expand All @@ -437,6 +446,7 @@ set(SOUFFLE_COMPILED_DEBUG_CXX_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
get_target_property(SOUFFLE_COMPILED_DEFS compiled COMPILE_DEFINITIONS)
get_target_property(SOUFFLE_COMPILED_OPTS compiled COMPILE_OPTIONS)
get_target_property(SOUFFLE_COMPILED_INCS compiled INCLUDE_DIRECTORIES)
get_property(SOUFFLE_COMPILED_LINK_OPTS TARGET compiled PROPERTY LINK_OPTIONS)

set(SOUFFLE_COMPILED_LIBS "")
set(SOUFFLE_COMPILED_RPATHS "")
Expand Down Expand Up @@ -524,7 +534,10 @@ endif ()

list(JOIN SOUFFLE_COMPILED_OPTS " " SOUFFLE_COMPILED_CXX_OPTIONS)

list(JOIN SOUFFLE_COMPILED_LIBS " " SOUFFLE_COMPILED_LINK_OPTIONS)
list(JOIN SOUFFLE_COMPILED_LIBS " " SOUFFLE_COMPILED_LINK_OPTIONS1)
list(JOIN SOUFFLE_COMPILED_LINK_OPTS " " SOUFFLE_COMPILED_LINK_OPTIONS2)
set(SOUFFLE_COMPILED_LINK_OPTIONS "")
string(APPEND SOUFFLE_COMPILED_LINK_OPTIONS " ${SOUFFLE_COMPILED_LINK_OPTIONS1}" " ${SOUFFLE_COMPILED_LINK_OPTIONS2}")

if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(SOUFFLE_COMPILED_LINK_OPTIONS "/link ${SOUFFLE_COMPILED_LINK_OPTIONS}")
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) {
std::string sub_str;
try {
sub_str = str.substr(idx, len);
} catch (...) {
} catch (std::out_of_range&) {
std::cerr << "warning: wrong index position provided by substr(\"";
std::cerr << str << "\"," << (int32_t)idx << "," << (int32_t)len << ") functor.\n";
}
Expand Down
2 changes: 1 addition & 1 deletion src/synthesiser/Synthesiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2812,7 +2812,7 @@ void Synthesiser::generateCode(GenDb& db, const std::string& id, bool& withShare
wrapper.setNextArg("std::size_t", "idx");
wrapper.setNextArg("std::size_t", "len");
wrapper.body() << "std::string result; \n"
<< "try { result = str.substr(idx,len); } catch(...) { \n"
<< "try { result = str.substr(idx,len); } catch(std::out_of_range&) { \n"
<< " std::cerr << \"warning: wrong index position provided by substr(\\\"\";\n"
<< " std::cerr << str << \"\\\",\" << (int32_t)idx << \",\" << (int32_t)len << "
"\") functor.\\n\";\n"
Expand Down
2 changes: 2 additions & 0 deletions tests/profile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ function(SOUFFLE_POSITIVE_PROF_TEST TEST_NAME)
endfunction()

if (NOT MSVC)
if (NOT (APPLE AND ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")))
souffle_positive_prof_test(lrg_attr_id)
souffle_positive_prof_test(recursive)
endif()
endif ()

0 comments on commit 6473787

Please sign in to comment.