GitHub Classroom / GitHub Actions Autograding, how to give positive feedback by mail? - github

We are experimenting and evaluating GitHub Classroom and GitHub Actions for "autograding".
In our assignment students get points if unit tests are passed. So the autograding.json is comparably simple running mvn test -Dtest=testClass#testmethod.
In the default setup I am unhappy with the following points:
GitHub (Actions) sends you a mail if the build (i.e. test) fails, but you do not receive a mail, if the test succeeds. It would be very nice if students get a feedback when they pass the autograding (i.e. unit test). How can this be done?
GitHub (Actions) does not provide any details in the mail, you have to visit the actions page. It would be nicer if you could supply the number of points and maybe some one-line explanation of the error. How can this be done?
To illustrate what I would like: it would be nice if the JSON allows to specify a feedback message upon success and a feedback message upon failure and the GitHub Action mail should contain this text (if that is not possible, there should be a nicely formatted web-page displaying this text). Unfortunately I did not find any documentation on the JSON. Is there any documentation of the autograde.json?
I am also interested in other options.
Here is an example for the autograde.json currently used by us:
{
"tests": [
{
"name": "Unit Tests - Testing your Application: DoubleVector - BasicFunctionality",
"setup": "",
"run": "mvn -q -B -Dtest=DoubleVectorFromArrayTest#testBasicFunctionality test",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 0.5
},
{
"name": "Unit Tests - Testing your Application: DoubleVector - Accuracy",
"setup": "",
"run": "mvn -q -B -Dtest=DoubleVectorFromArrayTest#testAccuracy test",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 0.5
},
{
"name": "Unit Tests - Testing your Application: QuadraticEuation",
"setup": "",
"run": "mvn -q -B -Dtest=QuadraticEuationFromCoefficientsTest test",
"input": "",
"output": "",
"comparison": "included",
"timeout": 10,
"points": 1
}
]
}

GHA doesn't provide such a functionality out of the box. Instead, you need to either implement it by your own, or use an existing action from the marketplace.
This is one example, which lets you send emails via smpt. (Note: I didn't use the linked action myself, but expect it to work).

Related

Seeks 'commentsResolvedState' API proposal, but it doesn't exist

[warning] Via 'product.json#extensionEnabledApiProposals' extension
'github.vscode-pull-request-github' wants API proposal
'commentsResolvedState' but that proposal DOES NOT EXIST. Likely, the
proposal has been finalized (check 'vscode.d.ts') or was abandoned.
I don't know what is this error msgs mean is it a bug on the current version of vscode 1.75.1?
I don't know why it's called extension even though I don't install any extension named github.vscode-pull-request-github
also I tried to (check 'vscode.d.ts') in my laptop. I dont find any file of it, there's only vscode.d. Well My code and project still works find but this error msg always appear every time I opened my vs code and kind of annoying to see. I use windows 11
This is what I found on github:
https://github.com/microsoft/vscode-pull-request-github/pull/4447/commits/f36acaff7b81f077db18e74a7c673cf249eba996
I tried to put the code in setting.json but it seems doesn't work. this is the code:
{
"name": "vscode-pull-request-github",
"displayName": "%displayName%",
"description": "%description%",
"icon": "resources/icons/github_logo.png",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-pull-request-github"
},
"bugs": {
"url": "https://github.com/Microsoft/vscode-pull-request-github/issues"
},
"enabledApiProposals": [
"tokenInformation",
"contribShareMenu",
"treeItemCheckbox",
"contribCommentPeekContext",

From within a Build/Release pipeline, can we discover its path?

In Azure DevOps, we can organize our Build/Release definitions into high-level folders:
Example: for every pipeline that resides in the Framework folder, I want to conditionally execute a certain task. The pre-defined Build and Release variables provide a plethora of ways to discover information about the underlying file system, but seemingly nothing for this internal path information.
During a pipeline run, is it possible to determine the folder/path that it resides in?
You can check it with Rest API - Builds - Get:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=6.0
In the response you get the definition details including the path:
"definition": {
"drafts": [
],
"id": 13,
"name": "TestBuild",
"url": "https://dev.azure.com/xxxxx/7fcdafd5-b891-4fe5-b2fe-xxxxxxx/_apis/build/Definitions/13?revision=1075",
"uri": "vstfs:///Build/Definition/13",
"path": "\\Test Folder",
"type": "build",
"queueStatus": "enabled",
"revision": 1075,
"project": {
"id": "7fcdafd5-b891-4fe5-b2fe-9b9axxxxx",
"name": "Sample",
"url": "https://dev.azure.com/xxxx/_apis/projects/7fcdafd5-b891-4fe5-b2fe-9xxxxxx",
"state": "wellFormed",
"revision": 97,
"visibility": "private",
"lastUpdateTime": "2021-03-22T10:25:39.33Z"
}
},
So:
Add a simple PS script that invokes the rest API (with the $(Build. BuildId) pre-defined variable)
Check the value of the path property
If it contains the Framework folder set a new variable with this command:
Write-Host "##vso[task.setvariable variable=isFramework;]true"
Now, in the task add a custom condition:
and(succeeded(), eq(variables['isFramework'], 'true'))

VS Code can't download symbols for test app

I would like to create a test environment for my app running in BC18, but I have trouble downloading the necessary symbols. I created a new workspace along with a .vscode/launch.json and an app.json-file, which contains the following properties:
"dependencies": [
{
"id": "65d313b7-f655-41af-9325-3ade0d3489e9",
"name": "Main App",
"publisher": "My Company",
"version": "1.0.1.0"
}
],
"test": "17.0.0.0"
However, when trying to download the symbols, I always get the following error:
[2021-05-18 15:39:06.44] The request for path /BC/dev/packages?publisher=Microsoft&appName=Test&versionText=17.0.0.0&tenant=default failed with code NotFound. Reason: No published package matches the provided arguments.
[2021-05-18 15:39:06.44] The following dependencies will be queried for propagated dependencies:
Application by Microsoft (18.0.0.0)
[2021-05-18 15:39:06.44] Sending request to http://ll-bc-at:7049/BC/dev/packages?publisher=Microsoft&appName=Application&versionText=18.0.0.0&tenant=default
[2021-05-18 15:39:06.45] Could not download reference symbols. Please ensure that:
1. The correct server name and instance are specified in the launch.json file.
2. The correct application version is specified in the app.json file.
3. The dependencies are correctly specified in the app.json file.
I've tried reinstalling the container, making sure the test toolkit is included and confirmed it is working properly by accessing the default test suite in the Test Tool, but nothing so far has been successful. Using different version for test hasn't had an effect either.
The test property has been deprecated. You will need to add the dependecies for the various test extensions you want to use.
I normally use these dependencies as a starting point:
{
"id": "e7320ebb-08b3-4406-b1ec-b4927d3e280b",
"name": "Any",
"publisher": "Microsoft",
"version": "17.0.0.0"
},
{
"id": "23de40a6-dfe8-4f80-80db-d70f83ce8caf",
"name": "Test Runner",
"publisher": "Microsoft",
"version": "17.0.0.0"
},
{
"id": "dd0be2ea-f733-4d65-bb34-a28f4624fb14",
"name": "Library Assert",
"publisher": "Microsoft",
"version": "17.0.0.0"
},
{
"id": "9856ae4f-d1a7-46ef-89bb-6ef056398228",
"name": "System Application Test Library",
"publisher": "Microsoft",
"version": "17.0.0.0"
},
{
"id": "5d86850b-0d76-4eca-bd7b-951ad998e997",
"name": "Tests-TestLibraries",
"publisher": "Microsoft",
"version": "17.0.0.0"
}

Can you read the properties of an artifact without downloading it?

I'm developing a release pipeline where I would like to do some analysis on a given artifact. I will not use the artifact itself for anything later, I'm only interested in reading certain properties such as version number. I, therefore, think that it is unnecessary to download an artifact that I won't do any changes to or to publish. From my point of view, the most time and resource-efficient way would be to not have to download the artifact, but I'm not sure if this is possible. Or are there workarounds, where you can download a "lite" version of the artifact? I'm planning on using a task for this.
If you want to get metadata for your build/pipeline artifact, you can't do this as there is no such thing. You can call this endpoint:
https://dev.azure.com/{{organization}}/{{project}}/_apis/build/builds/6179/artifacts?api-version=6.1-preview.5
but you will only get something like this:
{
"count": 1,
"value": [
{
"id": 1095,
"name": "drop",
"source": "12f1170f-54f2-53f3-20dd-22fc7dff55f9",
"resource": {
"type": "Container",
"data": "#/6799617/drop",
"properties": {
"localpath": "D:\\a\\1\\a",
"artifactsize": "1330651"
},
"url": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/6179/artifacts?artifactName=drop&api-version=6.1-preview.5",
"downloadUrl": "https://dev.azure.com/thecodemanual/4fa6b279-3db9-4cb0-aab8-e06c2ad550b2/_apis/build/builds/6179/artifacts?artifactName=drop&api-version=6.1-preview.5&%24format=zip"
}
}
]
}
If you want to get details of you package in Azure Artifact, which is a feed, you have some option in REST API. For instance: Artifact Details - Get Package Version

How do you add a checkbox input to an Azure DevOps Task Group?

In Azure DevOps, I have created a Task Group that runs Postman tests using the newman CLI. As inputs, users can pass in the paths to the Postman collection and environment files.
As the newman CLI is a requirement, the first task in the Task Group is to install it. However, in scenarios where several collections are run, there is no need to keep installing the CLI over and over, so I would like to offer a checkbox and then conditionally run the install task depending on the value of that checkbox.
As the UI for Task Groups is pretty lacking in useful options, I started exploring the API. I'm able to add additional inputs, but setting the obvious type option to checkbox yields only an additional text (string) input.
POST https://dev.azure.com/{org}/{project}/_apis/distributedtask/taskgroups?api-version=5.1-preview.1
{
...
"inputs": [
{
"aliases": [],
"options": {},
"properties": {},
"name": "Rbt.Cli.Install",
"label": "Install 'newman' CLI?",
"defaultValue": true,
"required": false,
"type": "checkbox",
"helpMarkDown": "Choose whether or not to install the 'newman' CLI. You only need to install it if it hasn't already been installed by a previos task running on this job.",
"groupName": ""
},
...
],
...
}
Looking more closely at the documentation, there is a definition for inputs - TaskInputDefinition. However, it looks as though whoever was tasked with writing that documentation left early one day and never got around to it. There are no descriptions at all, making it impossible to know valid values for properties in the definition.
How can I add a checkbox to my Task Group?
I have now found that Task Groups offer picklist as an input type. This has allowed be to present a yes/no option to the user, and based on their answer I am able to conditionally run a task.
I would still prefer to have a checkbox though, should anyone know how to do that.
{
"aliases": [],
"options": {
"yes": "Yes - install CLI",
"no": "No - the CLI has already been installed"
},
"properties": {},
"name": "Postman.Cli.Install",
"label": "Install 'newman' CLI?",
"defaultValue": "yes",
"required": true,
"type": "picklist",
"helpMarkDown": "Choose whether or not to install the 'newman' CLI. You only need to install it if it hasn't already been installed by a previos task running on this job.",
"groupName": ""
}
You can add checkbox to pipeline task easily by setting the type as boolean
{
"name": "Rbt.Cli.Install",
"type": "boolean",
"label": "Install 'newman' CLI?"
}
And also control the visibility of other controls based on the check box state as following:
{
"name": "someOtherField",
"type": "string",
"label": "Some other field",
"visibleRule": "Rbt.Cli.Install = true"
},