Commit 052072ff authored by Piotr Wosiek's avatar Piotr Wosiek

Update .NET Core YAML template - improve indent

Improve indent and remove empty lines
parent ab9aa821
...@@ -13,19 +13,17 @@ ...@@ -13,19 +13,17 @@
# and the Docker itself: https://opensource.com/resources/what-docker # and the Docker itself: https://opensource.com/resources/what-docker
image: microsoft/dotnet:latest image: microsoft/dotnet:latest
# ### Define variables # ### Define variables
# #
variables: variables:
# 1) Name of directory where restore and build objects are stored. # 1) Name of directory where restore and build objects are stored.
OBJECTS_DIRECTORY: 'obj' OBJECTS_DIRECTORY: 'obj'
# 2) Name of directory used for keeping restored dependencies. # 2) Name of directory used for keeping restored dependencies.
NUGET_PACKAGES_DIRECTORY: '.nuget' NUGET_PACKAGES_DIRECTORY: '.nuget'
# 3) A relative path to the source code from project repository root. # 3) A relative path to the source code from project repository root.
# NOTE: Please edit this path so it matches the structure of your project! # NOTE: Please edit this path so it matches the structure of your project!
SOURCE_CODE_PATH: '*/*/' SOURCE_CODE_PATH: '*/*/'
# ### Define stage list # ### Define stage list
# #
# In this example there are only two stages. # In this example there are only two stages.
...@@ -34,7 +32,6 @@ stages: ...@@ -34,7 +32,6 @@ stages:
- build - build
- test - test
# ### Define global cache rule # ### Define global cache rule
# #
# Before building the project, all dependencies (e.g. third-party NuGet packages) # Before building the project, all dependencies (e.g. third-party NuGet packages)
...@@ -52,28 +49,26 @@ cache: ...@@ -52,28 +49,26 @@ cache:
# Per-stage and per-branch caching. # Per-stage and per-branch caching.
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG" key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
paths: paths:
# Specify three paths that should be cached: # Specify three paths that should be cached:
# #
# 1) Main JSON file holding information about package dependency tree, packages versions, # 1) Main JSON file holding information about package dependency tree, packages versions,
# frameworks etc. It also holds information where to the dependencies were restored. # frameworks etc. It also holds information where to the dependencies were restored.
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json' - '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json'
# 2) Other NuGet and MSBuild related files. Also needed. # 2) Other NuGet and MSBuild related files. Also needed.
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*' - '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*'
# 3) Path to the directory where restored dependencies are kept. # 3) Path to the directory where restored dependencies are kept.
- '$NUGET_PACKAGES_DIRECTORY' - '$NUGET_PACKAGES_DIRECTORY'
# #
# 'pull-push' policy means that latest cache will be downloaded (if exists) # 'pull-push' policy means that latest cache will be downloaded (if exists)
# before executing the job, and a newer version will be uploaded afterwards. # before executing the job, and a newer version will be uploaded afterwards.
# Such setting saves time when there are no changes in referenced third-party # Such setting saves time when there are no changes in referenced third-party
# packages. For example if you run a pipeline with changes in your code, # packages. For example if you run a pipeline with changes in your code,
# but with no changes within third-party packages which your project is using, # but with no changes within third-party packages which your project is using,
# then project restore will happen in next to no time as all required dependencies # then project restore will happen in next to no time as all required dependencies
# will already be there — unzipped from cache. 'pull-push' policy is a default # will already be there — unzipped from cache. 'pull-push' policy is a default
# cache policy, you do not have to specify it explicitly. # cache policy, you do not have to specify it explicitly.
policy: pull-push policy: pull-push
#
# ### Restore project dependencies # ### Restore project dependencies
# #
# NuGet packages by default are restored to '.nuget/packages' directory # NuGet packages by default are restored to '.nuget/packages' directory
...@@ -85,33 +80,29 @@ cache: ...@@ -85,33 +80,29 @@ cache:
# Learn more about GitLab cache: https://docs.gitlab.com/ee/ci/caching/index.html # Learn more about GitLab cache: https://docs.gitlab.com/ee/ci/caching/index.html
before_script: before_script:
- 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY' - 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY'
build: build:
stage: build stage: build
# # ### Build all projects discovered from solution file.
# ### Build all projects discovered from solution file. #
# # Note: this will fail if you have any projects in your solution that are not
# Note: this will fail if you have any projects in your solution that are not # .NET Core based projects e.g. WCF service, which is based on .NET Framework,
# .NET Core based projects e.g. WCF service, which is based on .NET Framework, # not .NET Core. In such scenario you will need to build every .NET Core based
# not .NET Core. In such scenario you will need to build every .NET Core based # project by explicitly specifying a relative path to the directory
# project by explicitly specifying a relative path to the directory # where it is located e.g. 'dotnet build ./src/ConsoleApp'.
# where it is located e.g. 'dotnet build ./src/ConsoleApp'. # Only one project path can be passed as a parameter to 'dotnet build' command.
# Only one project path can be passed as a parameter to 'dotnet build' command.
script: script:
- 'dotnet build --no-restore' - 'dotnet build --no-restore'
tests: tests:
stage: test stage: test
# # ### Run the tests
# ### Run the tests #
# # You can either run tests for all test projects that are defined in your solution
# You can either run tests for all test projects that are defined in your solution # with 'dotnet test' or run tests only for specific project by specifying
# with 'dotnet test' or run tests only for specific project by specifying # a relative path to the directory where it is located e.g. 'dotnet test ./test/UnitTests'.
# a relative path to the directory where it is located e.g. 'dotnet test ./test/UnitTests'. #
# # You may want to define separate testing jobs for different types of testing
# You may want to define separate testing jobs for different types of testing # e.g. integration tests, unit tests etc.
# e.g. integration tests, unit tests etc.
script: script:
- 'dotnet test --no-restore' - 'dotnet test --no-restore'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment