Teamcity run build from one of vcs roots - version-control

I have TeamCity configuration which contains 2 vcs roots with identical directory structure:
root_1_svn
root_2_git
Build Steps:
ms_build_1
ms_build_2
Is it possible to build a solution for the vcs root in which there were changes only?
Example:
if updated root_1_svn, then TC run ms_build_1, ms_build_2 for code from root_1_svn only
if updated root_2_git, then TC run ms_build_1, ms_build_2 for code from root_2_git only

Related

Unable to run/debug robot tests in vscode - robocorp extensions installed

I have installed Robocorp Code as well as Robot Framework Language Server and have configured them. However, I am still having errors when trying to run the tests via the code lens options.
Repo - A webapi repo with a specific folder containing all tests. Lets call it regression.
RF - 4.1.3
Python - 3.8
This is what happens when I click on Run on the code lens for any of the tests -
`PS C:\git\xxxx\regression> C:; cd 'C:\git\xxxx\regression'; &
'C:\Users\xxxx\AppData\Local\Temp\rf-ls-run\run_env_00_smh5defr.bat'
'-u'
'c:\Users\xxxx.vscode\extensions\robocorp.robotframework-lsp-0.47.2\src\robotframework_debug_adapter\run_robot__main__.py'
'--port' '54331' '--no-debug' '--argumentfile'
'C:\git\xxxx\regression\args-local.txt' '--pythonpath'
'c:\git\xxxx\regression\common\lib' '--variable'
'EXECDIR:C:/git/xxxx/regression'
'--prerunmodifier=robotframework_debug_adapter.prerun_modifiers.FilteringTestsSuiteVisitor'
'c:\git\xxxx\regression\api\api_Test.robot'
[ ERROR ] Parsing'--pythonpath' failed: File or directory to execute does not exist.
However, the test starts if I remove the argumentfile parameter but it, of course, fails because its missing arguments from the file.
Do note that the folder specified in pythopath exists and has some python libraries needed for the tests.

Reusing the result of SBT compilation between Travis or Github Actions jobs

Does anyone know if it is possible to have a multi-stage Travis build that uses SBT (latest 1.4.3 version) and for each stage to reuse the compiled code from the previous one?
I tried with caching, but it does not seem to work (I hope I am just missing something).
What I have is a first “Compile” stage, and then a second “Tests” stage where two jobs are run in parallel (unit tests and integration tests).
What I want is that the Compile compiles everything (including test code) and then both the next stage just picks up where the compilation left.
I managed to organise the build to do that but:
either the compilation is re-done in each step or
by caching the whole ./ the compilation is saved…but then it ignores every new change I push (obviously).
The caching config I am using comes from the sbt docs:
cache:
directories:
- $HOME/.cache/coursier
- $HOME/.ivy2/cache
- $HOME/.sbt
Any idea?
(alternatively, if you know this is a problem of Travis and it can be made to work properly in Github Actions, that would be ok too)
There is a new Travis feature (in beta) that allows you to share files from one job with subsequent jobs in a build: workspaces
jobs:
include:
- stage: warm_cache
script:
- echo "foo" > foo.txt
workspaces:
create:
name: ws1
paths:
- foo.txt
- stage: use_cache
workspaces:
use: ws1
script:
- cat foo.txt || true
Also, SBT 1.4 allows you to push build artefacts to a Maven server and fetch then again later: https://www.scala-sbt.org/1.x/docs/Remote-Caching.html

Angular PWA missing ngsw.json and ngsw-worker file

I have a problem with #angular/pwa. when I am building in production mode I am not getting ngsw-worker.js and ngsw.json files in my dist folder.
the pwa version am using is:
#angular/pwa: ^0.13.8
#angular/service-worker: ~7.1.0
#angular version 7
Thanks in advance
This answer is only relevant when:
you use nrwl/nx
which decorates the ng command
and angular configuration composition:
i.e. ng build client --configuration=production,variant
nx version 11
Now the workaround for version 10 (see below) does not work anymore!
closed-nx#4296: Cannot pass in multiple configurations using -c since nx 11
actual fix should be handled in: nx#2839: NX does not handle multiple configurations: nx run app:build --configuration=production,stage-env
a workaround can be to opt-out of the nx ng-cli-decorate patch
quote from nx#4452:
To opt out of this patch:
Replace occurrences of nx with ng in your package.json Remove the
script from your postinstall script in your package.json Delete and
reinstall your node_modules
nx version 10
To fix the issue (we use nx version 10) we replaced:
ng build client --configuration=production,variant with
nx build client -c=production,variant
The problem was, that nx did not pass the configuration correctly to ng and thus ng did not build the production configuration (thus no PWA/service-worker)
Links to nx issues:
#2839: NX does not handle multiple configurations: nx run app:build --configuration=production,stage-env
#4296: Cannot pass in multiple configurations using -c since nx 11
You can copy the files from the node_modules folder (from a prompt in your project folder):
cp node_modules/#angular/service-worker/ngsw-worker.js ./src/ngsw-worker.js
cp node_modules/#angular/service-worker/ngsw-config.json ./ngsw-config.json
You may also need to make sure your service worker is registered. Nice presentation on the subject at: https://javascript-conference.com/wp-content/uploads/2017/12/Automatic_Progressive_Web_Apps_using_Angular_Service_Worker_Maxim_Salnikov.pdf

Deploying .NET Core Application with Windows Compatibility Pack

I'm busy deploying a .NET Core 2.1 application into our testing environment, but I'm getting the following error.
Error:
An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
package: 'System.Diagnostics.EventLog', version: '4.5.0'
path: 'runtimes/win/lib/netcoreapp2.1/System.Diagnostics.EventLog.dll'
We are using the Windows Compatibility Pack to access the Event Log.
I have the following item in the dependency Json file:
"System.Diagnostics.EventLog/4.5.0": {
"dependencies": {
"Microsoft.Win32.Registry": "4.5.0",
"System.Security.Permissions": "4.5.0",
"System.Security.Principal.Windows": "4.5.0",
"System.Threading.AccessControl": "4.5.0"
},
"runtime": {
"lib/netstandard2.0/System.Diagnostics.EventLog.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
},
"runtimeTargets": {
"runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
}
}
Please advise how one should deploy these dependencies. Also, what is the root folder to this relative path runtimes/win/lib/netcoreapp2.0?
We actually found a solution for our scenario:
- Our situation was that we tried to run a netcoreapp based test project on our test agent
- dotnet test on the project file worked
- dotnet vstest sometimes worked on the project output directory (we are not sure why and on which setup)
- dotnet vstest did run into the above error when run into an other directory & downloaded from CI
- dotnet vstest did run into an AssemblyNotFoundException on the test agent (which didn't make any sense for us)
The solution was to use dotnet publish for our test project and use the "self-contained" output to run on the test agent. dotnet publish copied the required runtimes/win/lib/netcoreappX.X/*.dll files into the publish output directory.
After a lot of testing, the key issue seems to be the "RuntimeIdentifiers". There is a visible option for this when you publish, but in order to use it when just building you need to add a couple of tags to your .csproj file.
The first is:
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
This will cause NuGet to retrieve the correct dlls (change the value depending on your needs). For me I was compiling to platform x86. I don't know what NuGet was getting by default, but whatever it was had different file sizes for the same files.
You also should then add this tag:
<SelfContained>false</SelfContained>
or else your build will default to copying the entire framework.
Also note that using the RuntimeIdentifier tag will cause your default output folder to include the value you specified. For example my subfolder became:
Project\bin\x86\Debug\netcoreapp3.1\win-86\
For publishing you should be able to do something similar; the problem will be to match your RuntimeIdentifier to your platform. You shouldn't need to specify SelfContained unless you specifically need to.

Building/Running/Tasks multiple dotnet project in Visual Studio code?

I have a project structure like the following and I would like to be able to run tasks on all projects at once so that i maybe able to build and run as well as run tests on all projects in one command using Visual Studio code? is this possible?
-global.json
-src
-Web
-project.json
-program.cs
-Web2
-project.json
-program.cs
-test
-Web.Test
-project.json
-program.cs
-Web2.Test
-project.json
-program.cs
You can add a solution file to your root folder with dotnet new sln. You can then add project references with dotnet sln add : https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-sln
dotnet build will then build all referenced projects, and dotnet test will run all unit tests found.