-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GitHub Actions for tests #31
Conversation
This was partially solved. It turned out that when running the test from studio For AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
{
var name = e.Name.Split(',').First() + ".dll";
return Assembly.LoadFile(Path.Combine(selfDir, name));
}; But
or this XamlX/src/XamlX/IL/SreTypeSystem.cs Line 27 in 697a419
which ultimately raises an exception like this XamlX/src/XamlX/TypeSystem/TypeSystem.cs Line 303 in 697a419
|
This actually works too, but dotnet test doesn't like it https://github.com/rstm-sf/XamlX/pull/3/checks#step:9:22 But it doesn't really work anywhere. I think need to think about it
|
I believe adding the github actions is done. It looks like they are disabled here |
@@ -135,11 +142,6 @@ public void TypeDescriptor_Stubs_Are_Somewhat_Usable() | |||
return "Value"; | |||
}, null); | |||
} | |||
|
|||
public static void SetAttachedProperty(ServiceProviderTestsClass target, string value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary so that there are no unnecessary messages during build. Since xunit thinks this is a test. If you mark this as private, the tests will stop passing. Therefore, I separated it to another class. It looks better to me -- less dependencies
Warning xUnit1013 Public method 'SetAttachedProperty' on test class 'ServiceProviderTests' should be marked as a Theory.
tests/CecilTests/CompilerTestBase.cs
Outdated
|
||
#if NETFRAMEWORK | ||
// TODO: It's the hack for VS tests | ||
var selfDirectory = Path.GetDirectoryName(typeof(CompilerTestBase).Assembly.Location); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check that we are running for Windows and using VS test platform? Or is it OK to do with dotnet test
+ Mono on Linux too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check that we are running for Windows and using VS test platform?
I did not consider this, as it seemed that it would be easier to limit the .NET Framework. In addition, in my opinion, this does not really affect, except that VS for some reason changes AppDomain.CurrentDomain.BaseDirectory
Or is it OK to do with dotnet test + Mono on Linux too?
I think not, besides mono/mono#6984
But I am far from using mono
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I have done for everyone, but with verification AppDomain.CurrentDomain.BaseDirectory
tests/CecilTests/CompilerTestBase.cs
Outdated
var selfDirectory = Path.GetDirectoryName(typeof(CompilerTestBase).Assembly.Location); | ||
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => | ||
{ | ||
var name = args.Name.Split(',').First() + ".dll"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do realize that .First() can be replaced with indexer access, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it seems to me that it will be more readable, and besides, it will still happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix to indexer access
- name: Build CecilNetstandardTests | ||
run: dotnet build tests/CecilNetstandardTests/CecilNetstandardTests.csproj | ||
- name: Build CecilTests | ||
run: dotnet build tests/CecilTests/CecilTests.csproj | ||
|
||
- name: Test for netcoreapp3.1 | ||
run: dotnet test --framework netcoreapp3.1 | ||
|
||
- name: Test for net47 CecilNetstandardTests | ||
if: matrix.os == 'windows-latest' | ||
run: dotnet test --framework net47 tests/CecilNetstandardTests/CecilNetstandardTests.csproj | ||
- name: Test for net47 CecilTests | ||
if: matrix.os == 'windows-latest' | ||
run: dotnet test --framework net47 tests/CecilTests/CecilTests.csproj | ||
- name: Test for net47 XamlParserTests | ||
if: matrix.os == 'windows-latest' | ||
run: dotnet test --framework net47 tests/XamlParserTests/XamlParserTests.csproj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also #35 (comment)
Probably the following setup might just work, however needs testing:
- name: Build Unit Test Projects
run: dotnet build tests/**/*Tests.csproj
- name: Run Unit Tests
run: dotnet test --no-build
working-directory: src
Copy-pasteing stuff usually isn't the best way to go.
@kekekeks hello, does it make sense to update it? |
Hello!
Add GitHub Actions for tests
net47
on VSCan also close_ #33