| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: C# |
| |
| on: |
| push: |
| branches-ignore: |
| - 'dependabot/**' |
| paths: |
| - '.github/workflows/csharp.yml' |
| - 'ci/scripts/csharp_*' |
| - 'csharp/**' |
| pull_request: |
| paths: |
| - '.github/workflows/csharp.yml' |
| - 'ci/scripts/csharp_*' |
| - 'csharp/**' |
| |
| concurrency: |
| group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} |
| cancel-in-progress: true |
| |
| permissions: |
| contents: read |
| |
| defaults: |
| run: |
| # 'bash' will expand to -eo pipefail |
| shell: bash |
| |
| jobs: |
| csharp: |
| name: "C# ${{ matrix.os }}" |
| runs-on: ${{ matrix.os }} |
| if: ${{ !contains(github.event.pull_request.title, 'WIP') }} |
| timeout-minutes: 15 |
| strategy: |
| fail-fast: false |
| matrix: |
| os: [ubuntu-latest, windows-2022, macos-15-intel, macos-latest] |
| steps: |
| # The test project multi-targets net8.0 and net10.0, so both SDKs must be |
| # installed: the .NET 8 SDK cannot build net10.0, and the net8.0 tests |
| # cannot run without the .NET 8 runtime. Requesting a single version here |
| # and relying on the runner image to supply the other leaves one target |
| # framework silently dependent on the image contents. |
| - name: Install C# |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 |
| with: |
| dotnet-version: | |
| 8.0.x |
| 10.0.x |
| - name: Checkout ADBC |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| with: |
| fetch-depth: 0 |
| submodules: recursive |
| persist-credentials: false |
| - name: Build |
| shell: bash |
| run: ci/scripts/csharp_build.sh $(pwd) |
| - name: Test |
| shell: bash |
| run: ci/scripts/csharp_test.sh $(pwd) |
| |
| # Publishes the AOT test fixture driver as a NativeAOT shared library (net10) |
| # and exercises it through the managed CAdbcDriverImporter. This catches |
| # AOT regressions (trim-unsafe reflection, missing exports, broken C-ABI |
| # marshaling) on both the import and export halves of csharp/src/Apache.Arrow.Adbc/C. |
| csharp-aot: |
| name: "C# NativeAOT fixture interop (${{ matrix.os }})" |
| runs-on: ${{ matrix.os }} |
| if: ${{ !contains(github.event.pull_request.title, 'WIP') }} |
| timeout-minutes: 30 |
| strategy: |
| fail-fast: false |
| matrix: |
| include: |
| - os: windows-2022 |
| rid: win-x64 |
| lib-name: Apache.Arrow.Adbc.TestFixture.Native.dll |
| - os: ubuntu-latest |
| rid: linux-x64 |
| lib-name: Apache.Arrow.Adbc.TestFixture.Native.so |
| - os: macos-latest |
| rid: osx-arm64 |
| lib-name: Apache.Arrow.Adbc.TestFixture.Native.dylib |
| steps: |
| - name: Checkout ADBC |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| with: |
| fetch-depth: 0 |
| submodules: recursive |
| persist-credentials: false |
| - name: Install .NET 10 |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 |
| with: |
| # NativeAOT requires net10. Using 10.0.x selects the latest |
| # available SDK; preview tags may be needed until GA. |
| dotnet-version: '10.0.x' |
| - name: Setup MSVC (for NativeAOT linker) |
| if: runner.os == 'Windows' |
| # Third-party action; activates vcvars64 so ilc's downstream |
| # link.exe step can find link.exe/lib.exe and the Windows SDK. |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 |
| - name: Publish AOT test fixture |
| shell: bash |
| run: | |
| dotnet publish \ |
| csharp/test/AotInterop/Apache.Arrow.Adbc.TestFixture.Native/Apache.Arrow.Adbc.TestFixture.Native.csproj \ |
| -c Release -r ${{ matrix.rid }} \ |
| -o csharp/artifacts/aot-fixture |
| - name: Run AOT interop tests |
| shell: bash |
| env: |
| ADBC_TEST_AOT_FIXTURE_PATH: ${{ github.workspace }}/csharp/artifacts/aot-fixture/${{ matrix.lib-name }} |
| run: | |
| dotnet test \ |
| csharp/test/AotInterop/Apache.Arrow.Adbc.TestFixture.Tests/Apache.Arrow.Adbc.TestFixture.Tests.csproj \ |
| -c Release |