Skip to content

Commit

Permalink
Merge pull request #194 from RussKie/154
Browse files Browse the repository at this point in the history
Use CI version of Python
  • Loading branch information
tonybaloney authored Sep 16, 2024
2 parents 6a4e781 + ebb3cdd commit 949b738
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 105 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/dotnet-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python }}"

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
Expand All @@ -52,9 +53,13 @@ jobs:
- name: Restore dependencies
run: dotnet restore
working-directory: src
env:
PYTHON_VERSION: ${{ steps.installpython.outputs.python-version }}

- name: Build
run: dotnet build --no-restore
working-directory: src

- name: Test
run: dotnet test --no-build --verbosity normal --collect "XPlat Code Coverage" --results-directory test-results --logger "trx;LogFileName=test-results-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.dotnet }}.trx"
working-directory: src
Expand Down
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<PythonVersion>3.12.4</PythonVersion>
<!-- See https://github.com/tonybaloney/CSnakes/issues/154#issuecomment-2352116849 -->
<PythonVersion Condition=" '$(PYTHON_VERSION)' != '' ">$(PYTHON_VERSION.Replace('alpha.','a').Replace('beta.','b').Replace('rc.','rc'))</PythonVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="python" Version="3.12.4" Condition="'$(IsWindows)' == 'true'" />
<PackageReference Include="python" Version="$(PythonVersion)" Condition="'$(IsWindows)' == 'true'" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/simple/QuickConsoleTest/QuickConsoleTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="CSnakes.Runtime" Version="1.*-*" />
<PackageReference Include="python" Version="3.12.4" />
<PackageReference Include="python" Version="$(PythonVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/simple/WebApp/WebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="CSnakes.Runtime" Version="1.*-*" />
<PackageReference Include="python" Version="3.12.4" />
<PackageReference Include="python" Version="$(PythonVersion)" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/CSnakes.Runtime.Tests/CSnakes.Runtime.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="python" Version="3.12.4" />
<PackageReference Include="python" Version="$(PythonVersion)" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
Expand Down
67 changes: 35 additions & 32 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<WarningsAsErrors>true</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\docs\res\logo.jpeg">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<Authors>Anthony Shaw, Aaron Powell</Authors>
<PackageProjectUrl>https://github.com/tonybaloney/CSnakes</PackageProjectUrl>
<PackageIcon>logo.jpeg</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/tonybaloney/CSnakes</RepositoryUrl>
<VersionPrefix>1.0.17</VersionPrefix>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<WarningsAsErrors>true</WarningsAsErrors>
</PropertyGroup>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\docs\res\logo.jpeg">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<PropertyGroup>
<EnableLocalPackaging>False</EnableLocalPackaging>
</PropertyGroup>
<PropertyGroup>
<Authors>Anthony Shaw, Aaron Powell</Authors>
<PackageProjectUrl>https://github.com/tonybaloney/CSnakes</PackageProjectUrl>
<PackageIcon>logo.jpeg</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/tonybaloney/CSnakes</RepositoryUrl>
<VersionPrefix>1.0.17</VersionPrefix>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup>
<EnableLocalPackaging>False</EnableLocalPackaging>
</PropertyGroup>
</Project>
84 changes: 16 additions & 68 deletions src/Integration.Tests/Integration.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,8 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>

<ItemGroup>
<None Remove="python\requirements.txt" />
<None Remove="python\test_args.py" />
<None Remove="python\test_basic.py" />
<None Remove="python\test_defaults.py" />
<None Remove="python\test_dependency.py" />
<None Remove="python\test_dicts.py" />
<None Remove="python\test_exceptions.py" />
<None Remove="python\test_false_returns.py" />
<None Remove="python\test_generators.py" />
<None Remove="python\test_keywords.py" />
<None Remove="python\test_none.py" />
<None Remove="python\test_reserved.py" />
<None Remove="python\test_tuples.py" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="python\test_args.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_basic.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_defaults.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_dependency.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_dicts.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_exceptions.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_false_returns.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_generators.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_keywords.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_none.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_reserved.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<AdditionalFiles Include="python\test_tuples.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
</ItemGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
Expand All @@ -68,7 +13,7 @@
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="python" Version="3.12.4" />
<PackageReference Include="python" Version="$(PythonVersion)" />
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.4.0" />
</ItemGroup>

Expand All @@ -77,15 +22,18 @@
<Using Include="CSnakes.Runtime" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CSnakes.Runtime\CSnakes.Runtime.csproj" />
<ProjectReference Include="..\CSnakes\CSnakes.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CSnakes.Runtime\CSnakes.Runtime.csproj" />
<ProjectReference Include="..\CSnakes\CSnakes.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
</ItemGroup>

<ItemGroup>
<Content Include="python\requirements.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="python\*.py">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</AdditionalFiles>
<Content Include="python\requirements.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Profile/Profile.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="17.12.35209.2" />
<PackageReference Include="python" Version="3.12.4" />
<PackageReference Include="python" Version="$(PythonVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 949b738

Please sign in to comment.