From e2ef3227544f7fd386b149cf8ec76882c60512f7 Mon Sep 17 00:00:00 2001 From: metagn Date: Sun, 6 Oct 2024 07:33:44 +0300 Subject: [PATCH] update CI to macos 13 (#24157) Followup to #24154, packages aren't ready for macos 14 (M1/ARM CPU) yet and it seems to be preview on azure, so upgrade to macos 13 for now. Macos 12 gives a warning: ``` You are using macOS 12. We (and Apple) do not provide support for this old version. It is expected behaviour that some formulae will fail to build in this old version. It is expected behaviour that Homebrew will be buggy and slow. Do not create any issues about this on Homebrew's GitHub repositories. Do not create any issues even if you think this message is unrelated. Any opened issues will be immediately closed without response. Do not ask for help from Homebrew or its maintainers on social media. You may ask for help in Homebrew's discussions but are unlikely to receive a response. Try to figure out the problem yourself and submit a fix as a pull request. We will review it but may or may not accept it. ``` (cherry picked from commit 4a63186cda97c6d41f0ed98fb94a6022ee4680ba) --- .github/workflows/ci_docs.yml | 2 +- .github/workflows/ci_packages.yml | 3 ++- azure-pipelines.yml | 5 ++-- doc/manual.md | 2 +- testament/categories.nim | 6 +++-- testament/important_packages.nim | 7 ++++- tests/closure/tboehmdeepcopy.nim | 1 + tests/cpp/temitlist.nim | 1 - tests/cpp/tempty_generic_obj.nim | 1 - tests/cpp/tmanual_exception.nim | 38 +++++++++++++++++++++++++++ tests/exception/tcpp_imported_exc.nim | 3 ++- 11 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 tests/cpp/tmanual_exception.nim diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index a0085f9f01f5..665eda110ed6 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -47,7 +47,7 @@ jobs: - target: windows os: windows-2019 - target: osx - os: macos-12 + os: macos-13 name: ${{ matrix.target }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/ci_packages.yml b/.github/workflows/ci_packages.yml index 795fde360c54..dc0ceb3faba9 100644 --- a/.github/workflows/ci_packages.yml +++ b/.github/workflows/ci_packages.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-12] + os: [ubuntu-20.04, macos-13] cpu: [amd64] batch: ["allowed_failures", "0_3", "1_3", "2_3"] # list of `index_num` name: '${{ matrix.os }} (batch: ${{ matrix.batch }})' @@ -48,6 +48,7 @@ jobs: - name: 'Install dependencies (macOS)' if: runner.os == 'macOS' run: brew install boehmgc make sfml gtk+3 + # XXX can't find boehm and gtk on macos 13 - name: 'Install dependencies (Windows)' if: runner.os == 'Windows' shell: bash diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 963935dc4520..0b7b8d571478 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,10 +29,10 @@ jobs: # vmImage: 'ubuntu-18.04' # CPU: i386 OSX_amd64: - vmImage: 'macOS-12' + vmImage: 'macOS-13' CPU: amd64 OSX_amd64_cpp: - vmImage: 'macOS-12' + vmImage: 'macOS-13' CPU: amd64 NIM_COMPILE_TO_CPP: true Windows_amd64_batch0_3: @@ -130,6 +130,7 @@ jobs: - bash: brew install boehmgc make sfml displayName: 'Install dependencies (OSX)' condition: and(succeeded(), eq(variables['skipci'], 'false'), eq(variables['Agent.OS'], 'Darwin')) + # XXX can't find boehm on macos 13 - bash: | set -e diff --git a/doc/manual.md b/doc/manual.md index 59d1646e1739..51f832a77b46 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -5083,7 +5083,7 @@ It is possible to raise/catch imported C++ exceptions. Types imported using `importcpp` can be raised or caught. Exceptions are raised by value and caught by reference. Example: - ```nim test = "nim cpp -r $1" + ```nim type CStdException {.importcpp: "std::exception", header: "", inheritable.} = object ## does not inherit from `RootObj`, so we use `inheritable` instead diff --git a/testament/categories.nim b/testament/categories.nim index c449cf3e04e0..a829f2ba49bd 100644 --- a/testament/categories.nim +++ b/testament/categories.nim @@ -103,7 +103,8 @@ proc dllTests(r: var TResults, cat: Category, options: string) = runBasicDLLTest c, r, cat, options & " -d:release --mm:refc" runBasicDLLTest c, r, cat, options, isOrc = true runBasicDLLTest c, r, cat, options & " -d:release", isOrc = true - when not defined(windows): + when not defined(windows) and not defined(osx): + # boehm library linking broken on macos 13 # still cannot find a recent Windows version of boehm.dll: runBasicDLLTest c, r, cat, options & " --gc:boehm" runBasicDLLTest c, r, cat, options & " -d:release --gc:boehm" @@ -130,7 +131,8 @@ proc gcTests(r: var TResults, cat: Category, options: string) = template test(filename: untyped) = testWithoutBoehm filename - when not defined(windows) and not defined(android): + when not defined(windows) and not defined(android) and not defined(osx): + # boehm library linking broken on macos 13 # AR: cannot find any boehm.dll on the net, right now, so disabled # for windows: testSpec r, makeTest("tests/gc" / filename, options & diff --git a/testament/important_packages.nim b/testament/important_packages.nim index b5e0dc3209cb..0e8585d0835f 100644 --- a/testament/important_packages.nim +++ b/testament/important_packages.nim @@ -107,7 +107,12 @@ pkg "nesm", "nimble tests", "https://github.com/nim-lang/NESM", useHead = true pkg "netty" pkg "nico", allowFailure = true pkg "nicy", "nim c -r src/nicy.nim" -pkg "nigui", "nim c -o:niguii -r src/nigui.nim" +when defined(osx): + # gives "could not load: libgtk-3.0.dylib" on macos 13 + # just test compiling instead of running + pkg "nigui", "nim c -o:niguii src/nigui.nim" +else: + pkg "nigui", "nim c -o:niguii -r src/nigui.nim" pkg "nimcrypto", "nim r --path:. tests/testall.nim" # `--path:.` workaround needed, see D20210308T165435 pkg "NimData", "nim c -o:nimdataa src/nimdata.nim" pkg "nimes", "nim c src/nimes.nim" diff --git a/tests/closure/tboehmdeepcopy.nim b/tests/closure/tboehmdeepcopy.nim index 7c937ca107c8..0b9e30117642 100644 --- a/tests/closure/tboehmdeepcopy.nim +++ b/tests/closure/tboehmdeepcopy.nim @@ -2,6 +2,7 @@ discard """ cmd: "nim c --gc:boehm $options $file" output: '''meep''' disabled: "windows" + disabled: osx """ proc callit(it: proc ()) = diff --git a/tests/cpp/temitlist.nim b/tests/cpp/temitlist.nim index 9170be079643..01549e978c26 100644 --- a/tests/cpp/temitlist.nim +++ b/tests/cpp/temitlist.nim @@ -3,7 +3,6 @@ discard """ output: ''' 6.0 0''' -disabled: "windows" # pending bug #18011 """ # bug #4730 diff --git a/tests/cpp/tempty_generic_obj.nim b/tests/cpp/tempty_generic_obj.nim index 6125190b4f0e..c42f08dcdd4a 100644 --- a/tests/cpp/tempty_generic_obj.nim +++ b/tests/cpp/tempty_generic_obj.nim @@ -3,7 +3,6 @@ discard """ output: ''' int float''' -disabled: "windows" # pending bug #18011 """ import typetraits diff --git a/tests/cpp/tmanual_exception.nim b/tests/cpp/tmanual_exception.nim new file mode 100644 index 000000000000..a91ccffe4cb2 --- /dev/null +++ b/tests/cpp/tmanual_exception.nim @@ -0,0 +1,38 @@ +discard """ + # doesn't work on macos 13 seemingly due to libc++ linking issue https://stackoverflow.com/a/77375947 + disabled: osx + targets: cpp +""" + +# manual example + +type + CStdException {.importcpp: "std::exception", header: "", inheritable.} = object + ## does not inherit from `RootObj`, so we use `inheritable` instead + CRuntimeError {.requiresInit, importcpp: "std::runtime_error", header: "".} = object of CStdException + ## `CRuntimeError` has no default constructor => `requiresInit` +proc what(s: CStdException): cstring {.importcpp: "((char *)#.what())".} +proc initRuntimeError(a: cstring): CRuntimeError {.importcpp: "std::runtime_error(@)", constructor.} +proc initStdException(): CStdException {.importcpp: "std::exception()", constructor.} + +proc fn() = + let a = initRuntimeError("foo") + doAssert $a.what == "foo" + var b: cstring + try: raise initRuntimeError("foo2") + except CStdException as e: + doAssert e is CStdException + b = e.what() + doAssert $b == "foo2" + + try: raise initStdException() + except CStdException: discard + + try: raise initRuntimeError("foo3") + except CRuntimeError as e: + b = e.what() + except CStdException: + doAssert false + doAssert $b == "foo3" + +fn() diff --git a/tests/exception/tcpp_imported_exc.nim b/tests/exception/tcpp_imported_exc.nim index 55a58440ffb5..0c7846956bb7 100644 --- a/tests/exception/tcpp_imported_exc.nim +++ b/tests/exception/tcpp_imported_exc.nim @@ -14,7 +14,8 @@ finally 2 expected cpp exception caught ''' -disabled: "windows" # pending bug #18011 +# doesn't work on macos 13 seemingly due to libc++ linking issue https://stackoverflow.com/a/77375947 +disabled: osx """ type