2024-04-27 15:12:16 +00:00
|
|
|
# To contribute improvements to CI/CD templates, please follow the Development guide at:
|
|
|
|
# https://docs.gitlab.com/ee/development/cicd/templates.html
|
|
|
|
# This specific template is located at:
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/dotNET-Core.gitlab-ci.yml
|
|
|
|
|
|
|
|
# This is a simple example illustrating how to build and test .NET Core project
|
|
|
|
# with GitLab Continuous Integration / Continuous Delivery.
|
2024-04-27 14:54:02 +00:00
|
|
|
#
|
2024-04-27 15:12:16 +00:00
|
|
|
# ### Specify the Docker image
|
2024-04-27 14:54:02 +00:00
|
|
|
#
|
2024-04-27 15:12:16 +00:00
|
|
|
# Instead of installing .NET Core SDK manually, a docker image is used
|
|
|
|
# with already pre-installed .NET Core SDK.
|
2024-04-27 14:54:02 +00:00
|
|
|
#
|
2024-04-27 15:12:16 +00:00
|
|
|
# The 'latest' tag targets the latest available version of .NET Core SDK image.
|
|
|
|
# If preferred, you can explicitly specify version of .NET Core (e.g. using '2.2-sdk' tag).
|
2024-04-27 14:54:02 +00:00
|
|
|
#
|
2024-04-27 15:12:16 +00:00
|
|
|
# See other available tags for .NET Core: https://hub.docker.com/_/microsoft-dotnet
|
|
|
|
# Learn more about Docker tags: https://docs.docker.com/glossary/?term=tag
|
|
|
|
# and the Docker itself: https://opensource.com/resources/what-docker
|
|
|
|
image: mcr.microsoft.com/dotnet/sdk:latest
|
2024-04-27 14:54:02 +00:00
|
|
|
|
2024-04-27 15:12:16 +00:00
|
|
|
# ### Define variables
|
|
|
|
#
|
|
|
|
variables:
|
|
|
|
# 1) Name of directory where restore and build objects are stored.
|
2024-04-27 18:01:08 +00:00
|
|
|
OBJECTS_DIRECTORY: 'IdeologyAddon/obj'
|
2024-04-27 15:12:16 +00:00
|
|
|
# 2) Name of directory used for keeping restored dependencies.
|
|
|
|
NUGET_PACKAGES_DIRECTORY: '.nuget'
|
|
|
|
# 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!
|
2024-04-27 15:22:58 +00:00
|
|
|
SOURCE_CODE_PATH: 'Source/'
|
2024-04-27 14:54:02 +00:00
|
|
|
|
2024-04-27 15:12:16 +00:00
|
|
|
# ### Define global cache rule
|
|
|
|
#
|
|
|
|
# Before building the project, all dependencies (e.g. third-party NuGet packages)
|
|
|
|
# must be restored. Jobs on GitLab.com's Shared Runners are executed on autoscaled machines.
|
|
|
|
#
|
|
|
|
# Each machine is used only once (for security reasons) and after that is removed.
|
|
|
|
# This means that, before every job, a dependency restore must be performed
|
|
|
|
# because restored dependencies are removed along with machines. Fortunately,
|
|
|
|
# GitLab provides cache mechanism with the aim of keeping restored dependencies
|
|
|
|
# for other jobs.
|
|
|
|
#
|
|
|
|
# This example shows how to configure cache to pass over restored
|
|
|
|
# dependencies for re-use.
|
|
|
|
#
|
|
|
|
# With global cache rule, cached dependencies will be downloaded before every job
|
|
|
|
# and then unpacked to the paths as specified below.
|
|
|
|
cache:
|
|
|
|
# Per-stage and per-branch caching.
|
|
|
|
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
|
|
|
|
paths:
|
|
|
|
# Specify three paths that should be cached:
|
|
|
|
#
|
|
|
|
# 1) Main JSON file holding information about package dependency tree, packages versions,
|
|
|
|
# frameworks etc. It also holds information where to the dependencies were restored.
|
|
|
|
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/project.assets.json'
|
|
|
|
# 2) Other NuGet and MSBuild related files. Also needed.
|
|
|
|
- '$SOURCE_CODE_PATH$OBJECTS_DIRECTORY/*.csproj.nuget.*'
|
|
|
|
# 3) Path to the directory where restored dependencies are kept.
|
|
|
|
- '$NUGET_PACKAGES_DIRECTORY'
|
|
|
|
#
|
|
|
|
# 'pull-push' policy means that latest cache will be downloaded (if it exists)
|
|
|
|
# before executing the job, and a newer version will be uploaded afterwards.
|
|
|
|
# Such a 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,
|
|
|
|
# but with no changes within third-party packages which your project is using,
|
|
|
|
# then project restore will happen quickly as all required dependencies
|
|
|
|
# will already be there — unzipped from cache.
|
2024-04-27 14:54:02 +00:00
|
|
|
|
2024-04-27 15:12:16 +00:00
|
|
|
# 'pull-push' policy is the default cache policy, you do not have to specify it explicitly.
|
|
|
|
policy: pull-push
|
2024-04-27 14:54:02 +00:00
|
|
|
|
2024-04-27 15:12:16 +00:00
|
|
|
# ### Restore project dependencies
|
|
|
|
#
|
|
|
|
# NuGet packages by default are restored to '.nuget/packages' directory
|
|
|
|
# in the user's home directory. That directory is out of scope of GitLab caching.
|
|
|
|
#
|
|
|
|
# To get around this, a custom path can be specified using the '--packages <PATH>' option
|
|
|
|
# for 'dotnet restore' command. In this example, a temporary directory is created
|
|
|
|
# in the root of project repository, so its content can be cached.
|
|
|
|
#
|
|
|
|
# Learn more about GitLab cache: https://docs.gitlab.com/ee/ci/caching/index.html
|
2024-04-28 14:00:17 +00:00
|
|
|
#before_script:
|
|
|
|
# - 'cd $SOURCE_CODE_PATH'
|
|
|
|
# - 'dotnet restore --packages ../$NUGET_PACKAGES_DIRECTORY'
|
2024-04-27 14:54:02 +00:00
|
|
|
|
2024-04-27 15:12:16 +00:00
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
# ### Build all projects discovered from solution file.
|
2024-04-27 14:54:02 +00:00
|
|
|
script:
|
2024-04-28 14:00:17 +00:00
|
|
|
- 'cd $SOURCE_CODE_PATH'
|
|
|
|
- 'dotnet restore --packages ../$NUGET_PACKAGES_DIRECTORY'
|
2024-04-27 18:29:44 +00:00
|
|
|
- 'curl -s --create-dirs "$RJW_DLL_URL" -o ../../rjw/$RIMWORLD_VERSION/Assemblies/RJW.dll'
|
2024-04-27 15:12:16 +00:00
|
|
|
- 'dotnet build --no-restore'
|
2024-04-28 05:59:59 +00:00
|
|
|
artifacts:
|
|
|
|
untracked: false
|
|
|
|
when: on_success
|
2024-04-28 13:51:52 +00:00
|
|
|
expire_in: 1 day
|
2024-04-28 06:02:09 +00:00
|
|
|
paths:
|
2024-04-28 06:31:20 +00:00
|
|
|
- "*" # Incluse everything
|
2024-04-28 06:11:32 +00:00
|
|
|
exclude:
|
2024-04-28 06:31:20 +00:00
|
|
|
- ".*" # Exclude dot files
|
|
|
|
- ".*/**/*" # Exclude everything in the dot folders
|
|
|
|
- "Source/**/*" # Exclude everything in the Source folder
|
2024-04-27 15:12:16 +00:00
|
|
|
|
|
|
|
#tests:
|
|
|
|
# stage: test
|
|
|
|
# ### Run the tests
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# (e.g. integration tests, unit tests etc).
|
|
|
|
# script:
|
|
|
|
# - 'dotnet test --no-restore'
|
|
|
|
|
2024-04-28 13:51:52 +00:00
|
|
|
release_dev:
|
|
|
|
stage: deploy
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
2024-04-28 14:11:08 +00:00
|
|
|
# rules:
|
|
|
|
# - if: $CI_COMMIT_TAG
|
|
|
|
# when: never # Do not run this job when a tag is created manually
|
|
|
|
# - if: $CI_COMMIT_BRANCH == "ci-test" # Run this job when commits are pushed or merged to the dev branch
|
2024-04-28 13:51:52 +00:00
|
|
|
script:
|
2024-04-28 15:10:02 +00:00
|
|
|
- 'echo "running release_job for $CI_COMMIT_SHA"'
|
2024-04-28 15:06:45 +00:00
|
|
|
# release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
|
|
|
|
# tag_name: 'test-build-$CI_PIPELINE_IID' # The version is incremented per pipeline.
|
|
|
|
# description: 'Automated release based on commit CI_COMMIT_SHA'
|
|
|
|
# ref: '$CI_COMMIT_BRANCH' # The tag is created from the pipeline SHA.
|
2024-04-28 13:51:52 +00:00
|
|
|
|