diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1d4e850..65676b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,10 @@ +include: + - template: Security/SAST.gitlab-ci.yml + stages: - build + - test + - release default: before_script: @@ -13,30 +18,19 @@ build: # Set up the environment. - npx npm install --ci - npx commitlint-gitlab-ci -x @commitlint/config-conventional - - # Build and test everything. - dotnet restore - dotnet build - #- 'dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"' - - # Summarize the output for Gitlab CI reporting. - #- dotnet new tool-manifest - #- dotnet tool install dotnet-reportgenerator-globaltool - #- dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary" - #- grep "Line coverage" coverage/Summary.txt - - # Perform the release. - - npx semantic-release - rules: - - if: '$CI_COMMIT_TITLE =~ /^chore\(release\)/' - when: never - - if: '$CI_COMMIT_TAG' - when: never - - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH' - when: never - - when: on_success - + - if: $CI_COMMIT_BRANCH + +test: + stage: test + script: + - 'dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"' + - dotnet new tool-manifest + - dotnet tool install dotnet-reportgenerator-globaltool + - dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary" + - grep "Line coverage" coverage/Summary.txt artifacts: when: always paths: @@ -49,3 +43,12 @@ build: - ./**/*test-result.xml cobertura: - ./coverage/Cobertura.xml + +publish: + stage: release + script: + - npm install --ci + - npm run build + - npx semantic-release + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/release.config.js b/release.config.js index 9184c5d..ba263fa 100644 --- a/release.config.js +++ b/release.config.js @@ -1,6 +1,6 @@ module.exports = { branches: ["main"], - message: "chore(release): v${nextRelease.version}\n\n${nextRelease.notes}", + message: "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}", plugins: [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator",