Skip to content

Conversation

@stefannikolei
Copy link
Contributor

* add it in ImageSharp.csproj
* update Buildscript
@antonfirsov
Copy link
Member

We had several discussions about this with @JimBobSquarePants, and if I'm not mistaken the conclusion was that net5.0 should be a test-only target.
The reason is that we don't expect to add 5.0-specific code to the library anytime soon, therefore it's not worth to pay the costs of an additional target for now (larger package, longer local builds, complexity etc.)

Nevertheless, it's very important to make our CI run tests against net5.0 so we can ensure that there are no regressions in the library on that platform. @stefannikolei any chance you can turn this into a test/CI-only change?

@stefannikolei
Copy link
Contributor Author

@antonfirsov Sure i can make that change. The pr in shared infrastructure needs to be merged too. Because I got only errors when I added net50 as target

@stefannikolei
Copy link
Contributor Author

Build is not working without the .net50 target framework

/usr/share/dotnet/sdk/5.0.101/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1005: Assets file '/home/runner/work/ImageSharp/ImageSharp/artifacts/obj/src/ImageSharp/project.assets.json' doesn't have a target for 'net5.0'. Ensure that restore has run and that you have included 'net5.0' in the TargetFrameworks for your project. [/home/runner/work/ImageSharp/ImageSharp/src/ImageSharp/ImageSharp.csproj]

@brianpopow
Copy link
Collaborator

brianpopow commented Jan 25, 2021

Build is not working without the .net50 target framework

I am able to build it as it is right now (without the .net50 target framework in the ImageSharp.csproj). Im using .Net SDK version 5.0.101. It also works on linux (with docker image mcr.microsoft.com/dotnet/sdk:5.0.101).

Not sure why it does not work for @stefannikolei and the CI. @stefannikolei: which .Net SDK version are you using?

@stefannikolei
Copy link
Contributor Author

On my Mac and rider I do not see that problem. Gonna look into the build script what they call there.

@stefannikolei
Copy link
Contributor Author

Ok i now know where the problem is.
In The build script we explicitly call the build with .net5 this is the call which fails.

@brianpopow
Copy link
Collaborator

Ok i now know where the problem is.
In The build script we explicitly call the build with .net5 this is the call which fails.

The build works now, but the test execution fails on mac-os in the CI. I do not have a mac to test this. @stefannikolei can you run ./ci-test.ps1 "macos-latest" "net5.0" "-x64" "false" and see if it works for you?

@stefannikolei
Copy link
Contributor Author

stefannikolei commented Jan 25, 2021

@brianpopow it is a vicious circle. It can not run because the .net5.0 dll was not build ...

If i remove the explicit Targetframework in ci-build.ps1 it builds all frameworks and the tests execute

@JimBobSquarePants
Copy link
Member

Wrap separate TargetFrameworks in the csproj files in a condition based on a custom environmental variable, one with NET5.0 one without. Then we can target the framework only when we need to during CI testing.

@stefannikolei
Copy link
Contributor Author

@JimBobSquarePants I added the env variable. But now i am hitting the problem why i opened SixLabors/SharedInfrastructure#15 on SharedInfrastructure...

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment regarding the targetframework options.

@codecov
Copy link

codecov bot commented Feb 1, 2021

Codecov Report

Merging #1519 (78d23c5) into master (954d233) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1519   +/-   ##
=======================================
  Coverage   83.50%   83.50%           
=======================================
  Files         742      742           
  Lines       32801    32801           
  Branches     3671     3671           
=======================================
  Hits        27392    27392           
  Misses       4691     4691           
  Partials      718      718           
Flag Coverage Δ
unittests 83.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 954d233...78d23c5. Read the comment docs.

@JimBobSquarePants
Copy link
Member

Oooh @stefannikolei I approved this but just realized there's an issue.

We only want NET5 on the build/test part, not on publish so we should be using a custom environmental property as the filter instead. Use SIXLABORS_TESTING both the Build and Test steps and as the MsBuild filter.

We're explicitly setting the CI variable in the Test step but we shouldn't be since it's a default for all steps.
https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables

@stefannikolei
Copy link
Contributor Author

SIXLABORS_TESTING

So just change CI with SIXLABORS_TESTING?

@JimBobSquarePants
Copy link
Member

So just change CI with SIXLABORS_TESTING?

Yep but you need to set it in both steps not just Test

- name: Build
shell: pwsh
run: ./ci-build.ps1 "${{matrix.options.framework}}"
- name: Test
shell: pwsh
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
env:
CI: True
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit

@stefannikolei
Copy link
Contributor Author

stefannikolei commented Feb 1, 2021

@JimBobSquarePants Want me to change TestEnvironment.cs to check for SIXLABORS_TESTING rather than CI, or should i add the CI back to the build script...

Hmm test failure seems unrelated, or am i mssing something?

@JimBobSquarePants
Copy link
Member

The failure is unrelated. It happens every so often when there’s heavy traffic in GitHub Actions. The CI environmental variable is always true here. GitHub set it. Check the link I shared for a list of defaults.

@JimBobSquarePants JimBobSquarePants merged commit 55678db into SixLabors:master Feb 2, 2021
JimBobSquarePants added a commit that referenced this pull request Mar 13, 2021
@stefannikolei stefannikolei deleted the net50 branch January 17, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants