Skip to content

Commit

Permalink
Build XcodeSDKs on CI (#1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
externl authored Feb 15, 2024
1 parent 8d201ad commit cae8401
Show file tree
Hide file tree
Showing 27 changed files with 201 additions and 860 deletions.
31 changes: 21 additions & 10 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
name: Build Ice

inputs:
language:
description: "The programming language to build"
required: true
type: string
make_flags:
description: "Additional flags to pass to make"
required: false
default: ""
type: string

runs:
using: "composite"
steps:
# Linux / macOS
- name: Build C++ Dependencies
run: make -j3 V=1 -C cpp srcs
run: make ${{ inputs.make_flags }} -j3 V=1 -C cpp srcs
shell: bash
if: runner.os == 'macOS' || runner.os == 'Linux'
if: (runner.os == 'macOS' || runner.os == 'Linux') && (inputs.language != 'cpp')

- name: Build C++ Tests for Scripting Languages
run: make -j3 V=1 -C cpp tests
run: make ${{ inputs.make_flags }} -j3 V=1 -C cpp tests
shell: bash
if: (runner.os == 'macOS' || runner.os == 'Linux') && (matrix.language == 'php' || matrix.language == 'js' || matrix.language == 'ruby')
if: (runner.os == 'macOS' || runner.os == 'Linux') && (inputs.language == 'php' || inputs.language == 'js' || inputs.language == 'ruby')

- name: Build ${{ matrix.language }}
working-directory: ./${{ matrix.language }}
- name: Build ${{ matrix.name || matrix.language }}
working-directory: ./${{ inputs.language }}
run: |
make -j3 V=1
make ${{ inputs.make_flags }} -j3 V=1
shell: bash
if: runner.os == 'macOS' || runner.os == 'Linux'

Expand All @@ -26,10 +37,10 @@ runs:
run: msbuild /m /p:Platform=x64 msbuild/ice.proj
working-directory: ./cpp
shell: powershell
if: runner.os == 'Windows'
if: (runner.os == 'Windows') && (inputs.language != 'cpp')

- name: Build ${{ matrix.language }}
- name: Build ${{ matrix.name || matrix.language }}
run: msbuild /m /p:Platform=x64 msbuild/ice.proj
working-directory: ./${{ matrix.language }}
working-directory: ./${{ inputs.language }}
shell: powershell
if: runner.os == 'Windows'
8 changes: 8 additions & 0 deletions .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ runs:
shell: bash
if: runner.os == 'macOS'

- name: Install xcodesdk dependencies
run: |
# We should consider removing the dependency on ice-xcode-builder
brew install zeroc-ice/tap/ice-builder-xcode
CFLAGS='-Wno-implicit-function-declaration' python3 -m pip install zeroc-ice
shell: bash
if: (runner.os == 'macOS') && (matrix.name == 'xcodesdk')

- name: Install apt dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
runs:
using: "composite"
steps:
- name: Test ${{ matrix.language }}
- name: Test ${{ matrix.name || matrix.language }}
run: python3 allTests.py --debug --all --continue --workers=4 --export-xml=test-report.xml --languages=${{ matrix.language }} ${{ inputs.flags }}
shell: bash
if: runner.os == 'macOS' || runner.os == 'Linux'
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ concurrency:

jobs:
ci:
name: ${{ matrix.language }} on ${{ matrix.os }}
name: ${{ matrix.name || matrix.language }} on ${{ matrix.os }}
strategy:
matrix:
language: [cpp]
os: [macos-14, ubuntu-latest, windows-latest]
name: [""]
make_flags: [""]
test_flags: [""]
include:
- os: macos-14
language: swift
Expand All @@ -29,6 +32,11 @@ jobs:
language: php
- os: macos-14
language: ruby
- os: macos-14
language: cpp
name: "xcodesdk"
make_flags: "CONFIGS=xcodesdk PLATFORMS='iphonesimulator'"
test_flags: "--config=xcodesdk --platform=iphonesimulator --controller-app"

- os: ubuntu-latest
language: csharp
Expand Down Expand Up @@ -56,13 +64,16 @@ jobs:
- name: Setup Dependencies
uses: ./.github/actions/setup-dependencies

- name: Build ${{ matrix.language }} on ${{ matrix.os }}
- name: Build ${{ matrix.name || matrix.language }} ${{matrix.make_flags}} on ${{ matrix.os }}
uses: ./.github/actions/build
timeout-minutes: 90
with:
language: ${{ matrix.language }}
make_flags: ${{ matrix.make_flags }}

- name: Test ${{ matrix.language }} on ${{ matrix.os }}
- name: Test ${{ matrix.name || matrix.language }} on ${{ matrix.os }}
uses: ./.github/actions/test
timeout-minutes: 90
with:
# See https://github.com/zeroc-ice/ice/issues/1653
flags: "--rfilter IceGrid/replication"
flags: "--rfilter IceGrid/replication ${{ matrix.test_flags }}"
80 changes: 35 additions & 45 deletions cpp/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@ ZeroC provides [Ice binary distributions][1] for many platforms and compilers,
including Windows and Visual Studio, so building Ice from source is usually
unnecessary.

- [C++ Build Requirements](#c-build-requirements)
- [Operating Systems and Compilers](#operating-systems-and-compilers)
- [Third-Party Libraries](#third-party-libraries)
- [AIX](#aix)
- [Linux](#linux)
- [macOS](#macos)
- [Windows](#windows)
- [Building Ice for AIX, Linux or macOS](#building-ice-for-aix-linux-or-macos)
- [Build configurations and platforms](#build-configurations-and-platforms)
- [C++11 mapping](#c11-mapping)
- [Ice Xcode SDK (macOS only)](#ice-xcode-sdk-macos-only)
- [Building Ice for Windows](#building-ice-for-windows)
- [Build Using MSBuild](#build-using-msbuild)
- [Build Using Visual Studio](#build-using-visual-studio)
- [Installing a C++ Source Build on AIX, Linux or macOS](#installing-a-c-source-build-on-aix-linux-or-macos)
- [Creating a NuGet Package on Windows](#creating-a-nuget-package-on-windows)
- [Cleaning the source build on AIX, Linux or macOS](#cleaning-the-source-build-on-aix-linux-or-macos)
- [Running the Test Suite](#running-the-test-suite)
- [AIX, Linux, macOS or Windows](#aix-linux-macos-or-windows)
- [iOS](#ios)
- [iOS Simulator](#ios-simulator)
- [iOS Device](#ios-device)
- [Building Ice for C++](#building-ice-for-c)
- [C++ Build Requirements](#c-build-requirements)
- [Operating Systems and Compilers](#operating-systems-and-compilers)
- [Third-Party Libraries](#third-party-libraries)
- [AIX](#aix)
- [Linux](#linux)
- [Amazon Linux 2](#amazon-linux-2)
- [RHEL 8](#rhel-8)
- [RHEL 7](#rhel-7)
- [SLES 12](#sles-12)
- [macOS](#macos)
- [Windows](#windows)
- [Building Ice for AIX, Linux or macOS](#building-ice-for-aix-linux-or-macos)
- [Build configurations and platforms](#build-configurations-and-platforms)
- [Ice Xcode SDK (macOS only)](#ice-xcode-sdk-macos-only)
- [Building Ice for Windows](#building-ice-for-windows)
- [Build Using MSBuild](#build-using-msbuild)
- [Build Using Visual Studio](#build-using-visual-studio)
- [Installing a C++ Source Build on AIX, Linux or macOS](#installing-a-c-source-build-on-aix-linux-or-macos)
- [Creating a NuGet Package on Windows](#creating-a-nuget-package-on-windows)
- [Cleaning the source build on AIX, Linux or macOS](#cleaning-the-source-build-on-aix-linux-or-macos)
- [Running the Test Suite](#running-the-test-suite)
- [AIX, Linux, macOS or Windows](#aix-linux-macos-or-windows)
- [iOS Simulator](#ios-simulator)
- [iOS Device](#ios-device)

## C++ Build Requirements

Expand Down Expand Up @@ -396,7 +399,7 @@ Python is required to run the test suite. Additionally, the Glacier2 tests
require the Python module `passlib`, which you can install with the command:

```shell
pip install passlib
python3 -m pip install passlib
```

After a successful source build, you can run the tests as follows:
Expand All @@ -411,48 +414,35 @@ the [python](../python) folder of this source distribution, or install the
Python module `zeroc-ice`, using the following command:

```shell
pip install zeroc-ice
python3 -m pip install zeroc-ice
```

In order to run the test suite on `iphoneos`, you need to build the
C++98 Test Controller app or C++11 Test Controller app from Xcode:
C++ Test Controller app from Xcode:

- Build the test suite with `make` for the `xcodedsk` or `cpp11-xcodesdk`
- Build the test suite with `make` for the `xcodedsk`
configuration, and the `iphoneos` platform.
- Open the C++ Test Controller project located in the
`cpp/test/ios/controller` directory.
- Build the `C++98 Test Controller` or the `C++11 Test Controller` app (it must
match the configuration(s) selected when building the test suite).
- Build the `C++ Test Controller` app.

#### iOS Simulator

- C++98 controller
- C++ controller

```shell
python allTests.py --config=xcodesdk --platform=iphonesimulator --controller-app
```

- C++11 controller

```shell
python allTests.py --config=cpp11-xcodesdk --platform=iphonesimulator --controller-app
python3 allTests.py --config=xcodesdk --platform=iphonesimulator --controller-app
```

#### iOS Device

- Start the `C++98 Test Controller` or the `C++11 Test Controller` app on your
- Start the `C++ Test Controller` app on your
iOS device, from Xcode.

- Start the C++98 controller on your Mac:

```shell
python allTests.py --config=xcodesdk --platform=iphoneos
```

- Start the C++11 controller on your Mac:
- Start the C++ controller on your Mac:

```shell
python allTests.py --config=cpp11-xcodesdk --platform=iphoneos
python3 allTests.py --config=xcodesdk --platform=iphoneos
```

All the test clients and servers run on the iOS device, not on your Mac
Expand Down
2 changes: 1 addition & 1 deletion cpp/config/Make.xcodesdk.rules
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

include $(top_srcdir)/config/Make.xcodesdk.rules

supported-configs += cpp98-xcodesdk cpp11-xcodesdk
supported-configs += xcodesdk

is-iostest-program = $(and $(filter-out macosx,$2),$(filter test/%,$1))

Expand Down
32 changes: 17 additions & 15 deletions cpp/src/Ice/Selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ EventHandlerWrapper::checkReady()
{
if((_ready | _handler->_ready) & ~_handler->_disabled & _handler->_registered)
{
_selector.addReadyHandler(this);
_selector.addReadyHandler(shared_from_this());
return false;
}
else
Expand Down Expand Up @@ -1189,7 +1189,7 @@ EventHandlerWrapper::update(SocketOperation remove, SocketOperation add)

// Clear ready flags which might not be valid anymore.
_ready = static_cast<SocketOperation>(_ready & _handler->_registered);
return _handler->getNativeInfo();
return _handler->getNativeInfo() != nullptr;
}

bool
Expand All @@ -1198,7 +1198,7 @@ EventHandlerWrapper::finish()
_finish = true;
_ready = SocketOperationNone;
_handler->_registered = SocketOperationNone;
return _handler->getNativeInfo();
return _handler->getNativeInfo() != nullptr;
}

Selector::Selector(const InstancePtr& instance) : _instance(instance), _destroyed(false)
Expand All @@ -1213,7 +1213,7 @@ Selector::Selector(const InstancePtr& instance) : _instance(instance), _destroye
_thread = make_shared<SelectorHelperThread>(*this);
_thread->start();

unique_lock<mutex> lock(_mutex);
unique_lock lock(_mutex);
_conditionVariable.wait(lock, [this] { return _runLoop != 0; });
}

Expand All @@ -1225,7 +1225,7 @@ void
Selector::destroy()
{
{
lock_guard lock(_mutex);
unique_lock lock(_mutex);

//
// Make sure any pending changes are processed to ensure remaining
Expand All @@ -1239,8 +1239,7 @@ Selector::destroy()
{
CFRunLoopSourceSignal(_source.get());
CFRunLoopWakeUp(_runLoop);

wait();
_conditionVariable.wait(lock);
}
}

Expand Down Expand Up @@ -1393,16 +1392,19 @@ Selector::select(int timeout)
_conditionVariable.wait(lock);
}

if(timeout > 0)
if (_readyHandlers.empty())
{
if(_conditionVariable.wait_for(chrono::seconds(timeout) == cv_status::no_timeout))
if(timeout > 0)
{
break;
if(_conditionVariable.wait_for(lock, chrono::seconds(timeout)) == cv_status::no_timeout)
{
break;
}
}
else
{
_conditionVariable.wait(lock);
}
}
else
{
_conditionVariable.wait(lock, [this] { return !_readyHandlers.empty(); });
}

if(_changes.empty())
Expand Down Expand Up @@ -1453,7 +1455,7 @@ Selector::ready(EventHandlerWrapper* wrapper, SocketOperation op, int error)
}

void
Selector::addReadyHandler(EventHandlerWrapper* wrapper)
Selector::addReadyHandler(EventHandlerWrapperPtr wrapper)
{
// Called from ready()
_readyHandlers.insert(wrapper);
Expand Down
8 changes: 2 additions & 6 deletions cpp/src/Ice/Selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ class Selector

void ready(EventHandler*, SocketOperation, bool);

#ifdef ICE_USE_IOCP
EventHandler* getNextHandler(SocketOperation&, DWORD&, int&, int);
#else
EventHandler* getNextHandler(SocketOperation&, int);
#endif

void completed(EventHandler*, SocketOperation);

Expand Down Expand Up @@ -203,7 +199,7 @@ class StreamNativeInfo : public NativeInfo
};
using StreamNativeInfoPtr = std::shared_ptr<StreamNativeInfo>;

class EventHandlerWrapper final : public SelectorReadyCallback
class EventHandlerWrapper final : public SelectorReadyCallback, public std::enable_shared_from_this<EventHandlerWrapper>
{
public:

Expand Down Expand Up @@ -268,7 +264,7 @@ class Selector
private:

void ready(EventHandlerWrapper*, SocketOperation, int = 0);
void addReadyHandler(EventHandlerWrapper*);
void addReadyHandler(EventHandlerWrapperPtr);

friend class EventHandlerWrapper;

Expand Down
Loading

0 comments on commit cae8401

Please sign in to comment.