From 2539d2a3843ea5fd4d1b5e1b3582657c26687437 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 10:06:35 -0400 Subject: [PATCH 1/9] Add .gitlab-ci.yml --- .gitlab-ci.yml | 117 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6939611 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,117 @@ +--- +# This is a simple example illustrating how to build and test .NET Core project +# with GitLab Continuous Integration / Continuous Delivery. + +# ### Specify the Docker image +# +# Instead of installing .NET Core SDK manually, a docker image is used +# with already pre-installed .NET Core SDK. +# +# 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). +# +# See other available tags for .NET Core: https://hub.docker.com/r/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: microsoft/dotnet:latest + +# ### Define variables +# +variables: + # 1) Name of directory where restore and build objects are stored. + OBJECTS_DIRECTORY: 'obj' + # 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! + SOURCE_CODE_PATH: 'ChaosBot/*/' + +# ### Define stage list +# +# In this example there are only two stages. +# Initially, the project will be built and then tested. +stages: + - build + - test + +# ### 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. + + # 'pull-push' policy is the default cache policy, you do not have to specify it explicitly. + policy: pull-push + +# ### 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 ' 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 +before_script: + - 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY' + +build: + stage: build + # ### Build all projects discovered from solution file. + # + # 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, + # not .NET Core. In this scenario, you will need to build every .NET Core-based + # project by explicitly specifying a relative path to the directory + # where it is located (e.g. 'dotnet build ./src/ConsoleApp'). + # Only one project path can be passed as a parameter to 'dotnet build' command. + script: + - 'dotnet build --no-restore' + +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' From b396d508003eb99d06b84e6d4ce5444e4270a9e8 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 10:08:11 -0400 Subject: [PATCH 2/9] Update .gitlab-ci.yml --- .gitlab-ci.yml | 81 ++------------------------------------------------ 1 file changed, 2 insertions(+), 79 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6939611..3a74ec6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,57 +1,17 @@ ---- -# This is a simple example illustrating how to build and test .NET Core project -# with GitLab Continuous Integration / Continuous Delivery. - -# ### Specify the Docker image -# -# Instead of installing .NET Core SDK manually, a docker image is used -# with already pre-installed .NET Core SDK. -# -# 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). -# -# See other available tags for .NET Core: https://hub.docker.com/r/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: microsoft/dotnet:latest -# ### Define variables -# + variables: - # 1) Name of directory where restore and build objects are stored. OBJECTS_DIRECTORY: 'obj' - # 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! SOURCE_CODE_PATH: 'ChaosBot/*/' -# ### Define stage list -# -# In this example there are only two stages. -# Initially, the project will be built and then tested. stages: - build - test -# ### 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: @@ -64,54 +24,17 @@ cache: # 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. - - # 'pull-push' policy is the default cache policy, you do not have to specify it explicitly. policy: pull-push -# ### 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 ' 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 before_script: - 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY' build: stage: build - # ### Build all projects discovered from solution file. - # - # 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, - # not .NET Core. In this scenario, you will need to build every .NET Core-based - # project by explicitly specifying a relative path to the directory - # where it is located (e.g. 'dotnet build ./src/ConsoleApp'). - # Only one project path can be passed as a parameter to 'dotnet build' command. script: - 'dotnet build --no-restore' 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' From d811d2ce4d91f2e1bcd5b348f8a1d4f0af5d4089 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 10:38:41 -0400 Subject: [PATCH 3/9] Update .gitlab-ci.yml --- .gitlab-ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a74ec6..9da41a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,10 +31,16 @@ before_script: build: stage: build + tags: + - docker + - hawkeye script: - 'dotnet build --no-restore' tests: stage: test + tags: + - docker + - hawkeye script: - 'dotnet test --no-restore' From 715e73a318bff994d6c2bdfd70f4bd422d66c92f Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 10:46:03 -0400 Subject: [PATCH 4/9] Update .gitlab-ci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9da41a8..64d1b2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ --- -image: microsoft/dotnet:latest +image: mcr.microsoft.com/dotnet/core/sdk:3.0-alpine3.11 variables: From 823ac61a7de7141ea9e4ab0a55b75fcc6ce23707 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 10:51:33 -0400 Subject: [PATCH 5/9] Add README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..cbf7190 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +[![pipeline status](http://git.chaoticlogic.us:8080/discord-bots/chaosbot/badges/master/pipeline.svg)](http://git.chaoticlogic.us:8080/discord-bots/chaosbot/-/commits/master) + +[![coverage report](http://git.chaoticlogic.us:8080/discord-bots/chaosbot/badges/master/coverage.svg)](http://git.chaoticlogic.us:8080/discord-bots/chaosbot/-/commits/master) + From 89abd2f34a768e4721f7061d0370645f7f532ef8 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 11:00:02 -0400 Subject: [PATCH 6/9] Update .gitlab-ci.yml --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64d1b2c..106a520 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,10 @@ variables: NUGET_PACKAGES_DIRECTORY: '.nuget' SOURCE_CODE_PATH: 'ChaosBot/*/' +only: + changes: + - ChaosBot/**/* + stages: - build - test From 6535534ce01288696cf2d157d9cb7501b27d9315 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 11:00:41 -0400 Subject: [PATCH 7/9] Update .gitlab-ci.yml --- .gitlab-ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 106a520..4e05530 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,10 +7,6 @@ variables: NUGET_PACKAGES_DIRECTORY: '.nuget' SOURCE_CODE_PATH: 'ChaosBot/*/' -only: - changes: - - ChaosBot/**/* - stages: - build - test @@ -32,9 +28,15 @@ cache: before_script: - 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY' + only: + changes: + - ChaosBot/**/* build: stage: build + only: + changes: + - ChaosBot/**/* tags: - docker - hawkeye @@ -43,6 +45,9 @@ build: tests: stage: test + only: + changes: + - ChaosBot/**/* tags: - docker - hawkeye From 9eebc660cd645571688597e2494d14455c4fc47d Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 11:00:59 -0400 Subject: [PATCH 8/9] Update .gitlab-ci.yml --- .gitlab-ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4e05530..1295048 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,9 +28,6 @@ cache: before_script: - 'dotnet restore --packages $NUGET_PACKAGES_DIRECTORY' - only: - changes: - - ChaosBot/**/* build: stage: build From 494b5f95a53bf10149145abbc3f81d3355567bb6 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Sat, 6 Jun 2020 11:05:50 -0400 Subject: [PATCH 9/9] Update .gitlab-ci.yml --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1295048..649ee81 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,8 @@ build: only: changes: - ChaosBot/**/* + refs: + - master tags: - docker - hawkeye @@ -45,6 +47,8 @@ tests: only: changes: - ChaosBot/**/* + refs: + - master tags: - docker - hawkeye