This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-dotnet.git


The following commit(s) were added to refs/heads/main by this push:
     new b9c2ae8  Run tests against nuget packages in verify_rc script (#114)
b9c2ae8 is described below

commit b9c2ae800f2e0b6031854c176ea3490e6eb645b4
Author: Adam Reeve <[email protected]>
AuthorDate: Fri Oct 10 06:27:46 2025 +0200

    Run tests against nuget packages in verify_rc script (#114)
    
    ## What's Changed
    
    * In `verify_rc.sh`, update test projects to reference the built NuGet
    packages instead of source project directories before running tests.
    * Changes the RC GitHub actions workflow to add a version suffix when
    building a non-RC version. This is required so that the locally built
    packages are used when testing rather than versions already published to
    NuGet.
    
    Closes #30.
    
    ---------
    
    Co-authored-by: Sutou Kouhei <[email protected]>
---
 .github/workflows/rc.yaml                         | 16 +++++----
 .pre-commit-config.yaml                           |  2 +-
 Apache.Arrow.Tests.slnf                           | 12 +++++++
 Directory.Build.props                             |  2 +-
 ci/scripts/pack.sh                                |  3 +-
 ci/scripts/test.sh                                |  2 +-
 dev/release/rat_exclude_files.txt                 |  1 +
 dev/release/verify_rc.sh                          | 42 +++++++++++++++++++++--
 test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj | 14 ++++----
 9 files changed, 74 insertions(+), 20 deletions(-)

diff --git a/.github/workflows/rc.yaml b/.github/workflows/rc.yaml
index 57172f8..a877b46 100644
--- a/.github/workflows/rc.yaml
+++ b/.github/workflows/rc.yaml
@@ -40,6 +40,7 @@ jobs:
     timeout-minutes: 5
     outputs:
       version: ${{ steps.detect.outputs.version }}
+      version_suffix: ${{ steps.detect.outputs.version_suffix }}
       rc: ${{ steps.detect.outputs.rc }}
     steps:
       - name: Checkout
@@ -49,15 +50,19 @@ jobs:
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
-          version=$(grep -E -o '<Version>(.*)</Version>' \
+          version=$(grep -E -o '<VersionPrefix>(.*)</VersionPrefix>' \
                       Directory.Build.props |
-                      sed -E -e 's,</?Version>,,g')
+                      sed -E -e 's,</?VersionPrefix>,,g')
           if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
             rc=${GITHUB_REF_NAME#*-rc}
+            version_suffix=""
           else
             rc=$(date +%Y%m%d)
+            version_suffix="${rc}"
+            version="${version}-${version_suffix}"
           fi
           echo "version=${version}" >> ${GITHUB_OUTPUT}
+          echo "version_suffix=${version_suffix}" >> ${GITHUB_OUTPUT}
           echo "rc=${rc}" >> ${GITHUB_OUTPUT}
 
   source:
@@ -66,7 +71,6 @@ jobs:
     runs-on: ubuntu-latest
     timeout-minutes: 5
     env:
-      RC: ${{ needs.target.outputs.rc }}
       VERSION: ${{ needs.target.outputs.version }}
     steps:
       - name: Checkout
@@ -95,8 +99,7 @@ jobs:
     runs-on: ubuntu-latest
     timeout-minutes: 15
     env:
-      RC: ${{ needs.target.outputs.rc }}
-      VERSION: ${{ needs.target.outputs.version }}
+      VERSION_SUFFIX: ${{ needs.target.outputs.version_suffix }}
     steps:
       - name: Checkout
         uses: actions/checkout@v5
@@ -104,7 +107,7 @@ jobs:
           fetch-depth: 0
       - name: Build
         run: |
-          ci/scripts/pack.sh "$(pwd)"
+          ci/scripts/pack.sh "$(pwd)" "${VERSION_SUFFIX}"
       - name: Prepare artifacts
         run: |
           shopt -s globstar
@@ -175,7 +178,6 @@ jobs:
     runs-on: ubuntu-latest
     timeout-minutes: 5
     env:
-      RC: ${{ needs.target.outputs.rc }}
       VERSION: ${{ needs.target.outputs.version }}
     permissions:
       contents: write
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 28612c1..b4fe952 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -39,7 +39,7 @@ repos:
         name: Format
         language: system
         entry: |
-          dotnet format --exclude src/Apache.Arrow/Flatbuf/FlatBuffers/
+          dotnet format Apache.Arrow.sln --exclude 
src/Apache.Arrow/Flatbuf/FlatBuffers/
         always_run: true
         pass_filenames: false
   - repo: https://github.com/koalaman/shellcheck-precommit
diff --git a/Apache.Arrow.Tests.slnf b/Apache.Arrow.Tests.slnf
new file mode 100644
index 0000000..78fe147
--- /dev/null
+++ b/Apache.Arrow.Tests.slnf
@@ -0,0 +1,12 @@
+{
+  "solution": {
+    "path": "Apache.Arrow.sln",
+    "projects": [
+      
"test\\Apache.Arrow.Compression.Tests\\Apache.Arrow.Compression.Tests.csproj",
+      
"test\\Apache.Arrow.Flight.Sql.Tests\\Apache.Arrow.Flight.Sql.Tests.csproj",
+      "test\\Apache.Arrow.Flight.Tests\\Apache.Arrow.Flight.Tests.csproj",
+      "test\\Apache.Arrow.Flight.TestWeb\\Apache.Arrow.Flight.TestWeb.csproj",
+      "test\\Apache.Arrow.Tests\\Apache.Arrow.Tests.csproj"
+    ]
+  }
+}
diff --git a/Directory.Build.props b/Directory.Build.props
index 4dab837..5845597 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -28,7 +28,7 @@
     <Product>Apache Arrow library</Product>
     <Copyright>Copyright 2016-2024 The Apache Software Foundation</Copyright>
     <Company>The Apache Software Foundation</Company>
-    <Version>22.0.1</Version>
+    <VersionPrefix>22.0.1</VersionPrefix>
   </PropertyGroup>
 
   <PropertyGroup>
diff --git a/ci/scripts/pack.sh b/ci/scripts/pack.sh
index 28fe8de..ee1b571 100755
--- a/ci/scripts/pack.sh
+++ b/ci/scripts/pack.sh
@@ -20,7 +20,8 @@
 set -eux
 
 source_dir=${1}
+version_suffix="${2:-}"
 
 pushd "${source_dir}"
-dotnet pack -c Release
+dotnet pack -c Release --version-suffix "${version_suffix}"
 popd
diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh
index a4a4385..5a8d4d6 100755
--- a/ci/scripts/test.sh
+++ b/ci/scripts/test.sh
@@ -42,5 +42,5 @@ fi
 export PYTHONNET_PYDLL
 
 pushd "${source_dir}"
-dotnet test
+dotnet test Apache.Arrow.Tests.slnf
 popd
diff --git a/dev/release/rat_exclude_files.txt 
b/dev/release/rat_exclude_files.txt
index c2b32b7..14a5af7 100644
--- a/dev/release/rat_exclude_files.txt
+++ b/dev/release/rat_exclude_files.txt
@@ -18,6 +18,7 @@
 *.csproj
 *.resx
 *.sln
+*.slnf
 .github/pull_request_template.md
 src/Apache.Arrow/Flatbuf/*
 docs/images/*.png
diff --git a/dev/release/verify_rc.sh b/dev/release/verify_rc.sh
index 8622645..5e24fcc 100755
--- a/dev/release/verify_rc.sh
+++ b/dev/release/verify_rc.sh
@@ -138,6 +138,20 @@ test_source_distribution() {
   "${TOP_SOURCE_DIR}/ci/scripts/test.sh" "$(pwd)"
 }
 
+reference_package() {
+  # First argument is the package name
+  local package=${1}
+  shift
+
+  # Subsequent arguments are test projects that need to reference
+  # the package instead of the local project.
+  while [ $# -gt 0 ]; do
+    dotnet remove "test/${1}" reference "src/${package}/${package}.csproj"
+    dotnet add "test/${1}" package "${package}" --version "${VERSION}" 
--no-restore
+    shift
+  done
+}
+
 test_binary_distribution() {
   if [ "${VERIFY_BINARY}" -le 0 ]; then
     return 0
@@ -145,12 +159,36 @@ test_binary_distribution() {
 
   local package
   local package_type
-  for package in $(cd src && echo *); do
+  local nuget_dir
+
+  # Create NuGet local directory source
+  mkdir nuget
+  dotnet new nugetconfig
+  nuget_dir="$(pwd)/nuget"
+  if [ -n "${MSYSTEM:-}" ]; then
+    dotnet nuget add source -n local "$(cygpath --absolute --windows 
"${nuget_dir}")"
+  else
+    dotnet nuget add source -n local "${nuget_dir}"
+  fi
+
+  pushd nuget
+  for package in $(cd ../src && echo *); do
     for package_type in nupkg snupkg; do
       fetch_artifact "${package}.${VERSION}.${package_type}"
     done
-    # TODO: Can we run tests against .nuget package?
   done
+  popd
+
+  # Update test projects to reference NuGet packages for the release candidate
+  reference_package "Apache.Arrow" "Apache.Arrow.Tests" 
"Apache.Arrow.Compression.Tests"
+  reference_package "Apache.Arrow.Compression" "Apache.Arrow.Compression.Tests"
+  reference_package "Apache.Arrow.Flight.Sql" "Apache.Arrow.Flight.Sql.Tests" 
"Apache.Arrow.Flight.TestWeb"
+  reference_package "Apache.Arrow.Flight.AspNetCore" 
"Apache.Arrow.Flight.TestWeb"
+
+  # Move src directory to ensure we are only testing against built packages
+  mv src src.backup
+
+  "${TOP_SOURCE_DIR}/ci/scripts/test.sh" "$(pwd)"
 }
 
 github_actions_group_end
diff --git a/test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj 
b/test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj
index 0d957cc..7ebff43 100644
--- a/test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj
+++ b/test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj
@@ -15,6 +15,13 @@
     <TargetFrameworks>net8.0</TargetFrameworks>
   </PropertyGroup>
 
+  <ItemGroup>
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
+    <PackageReference Include="xunit" Version="2.9.3" />
+    <PackageReference Include="xunit.skippablefact" Version="1.5.23" />
+    <PackageReference Include="pythonnet" Version="3.0.5" />
+  </ItemGroup>
+
   <ItemGroup Condition="'$(TargetFramework)' == 'net462'">
     <PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
       <PrivateAssets>all</PrivateAssets>
@@ -28,13 +35,6 @@
     </PackageReference>
   </ItemGroup>
 
-  <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
-    <PackageReference Include="xunit" Version="2.9.3" />
-    <PackageReference Include="xunit.skippablefact" Version="1.5.23" />
-    <PackageReference Include="pythonnet" Version="3.0.5" />
-  </ItemGroup>
-
   <ItemGroup>
     <ProjectReference Include="..\..\src\Apache.Arrow\Apache.Arrow.csproj" />
   </ItemGroup>

Reply via email to