I am working on a .NET configuration file for a WPF C# project. My build_job creates dlls, that my test_job needs to access. Currently I’ve been doing something like this:
build_job:
stage: build
only:
- tags
script:
- '"%NUGET_PATH%" restore'
- '"%MSBUILD_PATH%" /p:Configuration=Release'
artifacts:
expire_in: 1 week
paths:
- "%RELEASE_FOLDER%AutoBuildWpfTest.exe"
- "%RELEASE_FOLDER%NLog.config"
- "%RELEASE_FOLDER%NLog.dll"
- "%TEST_FOLDER%Tests.dll"
test_job:
stage: test
only:
- tags
script:
- '"%NUNIT_RUNNER_PATH%" %TEST_FOLDER%Tests.dll'
dependencies:
- build_job
The problem with this approach is that my artifacts.zip file is now polluted with files that were only needed for testing, but are not required for actual deployment.
My question is how can I share the files between jobs without them showing up in artifacts.zip?
Also, is there any way to add files to artifacts.zip without preserving the directory tree? When building .NET projects you end up with some pretty deep directories, for example my output executables are in:
AutoBuildWpfTest\bin\Release\
, so when they get zipped up, and you try to open them, you have to go through 4 folder levels to get to the file you want. Ideally, I’d want all my output files, right in the root of artifact.zip. Thanks.