I don’t think it is currently possible to run dotnet inside autograding. Child processes are spawned with only PATH and FORCE_COLOR environmental variables set. Trying to set variables in either the workflow, or in the setup field won’t work. The same problem seems to effect Golang as well. Both languages require specific environmental variables to be set.
I opened a PR for this, but I’m not sure if it will get any attention.
If you want a work-around for dotnet testing (or any testing that requires context or env) and to have grading scores reported in the GH Classroom interface:
add the .github/workflows/classroom.yml and .github/classroom/autograding.json files to your template starter repository. Don’t use the Classroom interface to create the autograding tests.
add your dotnet tests as steps in classroom.yml workflow. For each test, if the test passes drop a file (e.g. ‘.github/results/test-1.txt’)
in autograding.json add a test to check if the file exists. (e.g. "[ -e .github/results/test-1.txt ] && exit 0 || exit 1")
@acrokat Can the development team look at this? Not being able to use dotnet or Golang in autograding is a big issue.
I’m currently experimenting with .NET 6 and autograding and this run command works for me: DOTNET_CLI_HOME=/tmp/ dotnet test Probably would be better to set it to $PWD? But this works…
Thanks, @markpatterson27! This solution worked!
It’s probably worth to mention that if you need to do an exact string match on the output, the welcome message needs to be suppressed. This is the full command I ran and tested: DOTNET_CLI_HOME=/tmp/ DOTNET_NOLOGO=true dotnet run