Skip to content

Commit

Permalink
gh actions fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vilinski committed Feb 4, 2024
1 parent 1ae1800 commit 9f63b32
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 31 deletions.
77 changes: 50 additions & 27 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

name: dotnet build and test

env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1

on:
push:
branches: [ "main" ]
Expand All @@ -11,58 +15,77 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
dotnet-version: ['8.x' ]
# os:
# - ubuntu-latest
# - macos-latest
# - macos-14
# rid: # [ "linux-x64", "linux-arm64", "osx-x64", "osx-arm64" ]
# - linux-x64
# - linux-arm64
# - osx-x64
# - osx-arm64
include:
- os: ubuntu-latest
rid: linux-x64
- os: macos-latest
rid: osx-x64
- os: macos-14
rid: osx-arm64

steps:
- uses: actions/checkout@v4
- name: Setup .NET Core 6.x

- name: Cache libchdb.so
id: cache-libchdb
uses: actions/cache@v4
with:
path: libchdb.so
key: ${{ matrix.rid }}-libchdb

- name: Download chdb library
if: steps.cache-libchdb.outputs.cache-hit != 'true'
run: ./update_libchdb.sh

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
8.0.x
# cache: true
cache: true

- name: Display dotnet version
run: dotnet --version
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
# - name: Cache libchdb.so
# id: cache-libchdb
# uses: actions/cache@v4
# with:
# path: libchdb.so
# key: ${{ runner.os }}-libchdb
- name: Download chdb library
# if: steps.cache-libchdb.outputs.cache-hit != 'true'
run: ./update_libchdb.sh
# - uses: actions/cache@v3
# with:
# path: ~/.nuget/packages
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
# restore-keys: |
# ${{ runner.os }}-nuget-

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Test
run: dotnet test --configuration Release --no-build --logger trx --results-directory "TestResults-${{ matrix.dotnet-version }}"
run: dotnet test -c Release --logger trx --results-directory "TestResults-${{ matrix.rid }}"

- name: Upload dotnet test results
uses: actions/upload-artifact@v4
with:
name: dotnet-results-${{ matrix.dotnet-version }}
path: TestResults-${{ matrix.dotnet-version }}
name: dotnet-results-${{ matrix.rid }}
path: TestResults-${{ matrix.rid }}
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}

- name: Test chdb-tool
run: |
dotnet tool install --global chdb-tool --version 0.0.1
dotnet tool install --add-sources ./nupkg --global chdb-tool --version 0.0.1
chdb --help
chdb "select version()" PrettyCompact
- name: Pack
run: dotnet pack -c Release --include-symbols
run: |
dotnet pack src/chdb/chdb.csproj -c Release --include-symbols -p:PackageID=chdb-${{ matrix.rid }} -r ${{ matrix.rid }}
dotnet pack src/chdb-tool/chdb-tool.csproj -c Release -p:PackageID=chdb-tool${{ matrix.rid }} -r ${{ matrix.rid }}
- name: List artifacts
run: ls -l nupkg/*.nupkg
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<LangVersion>latest</LangVersion>
<RootNamespace>ChDb</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="!$(MSBuildProjectName.EndsWith('Test')) AND !$(MSBuildProjectName.EndsWith('.Benchmarks'))">
<PackageOutputPath>../../nupkg</PackageOutputPath>
<Version>0.0.1-alpha</Version>
Expand Down
6 changes: 3 additions & 3 deletions test/ChDbTest/test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.2.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.2.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>

Expand Down

0 comments on commit 9f63b32

Please sign in to comment.