This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-gallium-cil/.gitlab-ci.yml

68 lines
2.2 KiB
YAML
Raw Normal View History

include:
- template: Security/SAST.gitlab-ci.yml
2021-11-19 03:46:48 +00:00
# Nix handling based on https://gitlab.com/Vonfry/gitlab-ci-nix/-/blob/master/.gitlab-ci.yml
2021-09-07 04:15:21 +00:00
stages:
- build
2021-11-19 03:46:48 +00:00
- test
- release
variables:
GIT_SUBMODULE_STRATEGY: recursive
LOCAL_NIX_STORE: $CI_PROJECT_DIR/.nix/store
2021-09-07 04:15:21 +00:00
default:
2021-11-19 03:46:48 +00:00
image: nixos/nix:latest
2021-09-07 04:15:21 +00:00
before_script:
2021-11-19 03:46:48 +00:00
- "[ -f $LOCAL_NIX_STORE ] && nix-store --import < $LOCAL_NIX_STORE"
after_script:
- "[ ! -d $(dirname \"$LOCAL_NIX_STORE\") ] && mkdir -p $LOCAL_NIX_STORE"
- "[ -h ./result ] && nix-store --export $(nix-store --query --requisites --include-outputs ./result) > $LOCAL_NIX_STORE"
cache:
paths:
- .nix/
2021-09-07 04:15:21 +00:00
build:
stage: build
script:
2021-11-19 03:46:48 +00:00
- nix-shell --run "npm install --ci"
- nix-shell --run "npx commitlint-gitlab-ci -x @commitlint/config-conventional"
- nix-shell --run "npm run build"
2021-09-07 04:15:21 +00:00
rules:
2021-11-19 03:46:48 +00:00
- if: $CI_COMMIT_BRANCH
2021-09-07 04:15:21 +00:00
2021-11-19 03:46:48 +00:00
test:
stage: test
script:
- nix-shell --run "npm run test"
# Testing is currently not working.
#- '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
2021-09-07 04:15:21 +00:00
artifacts:
when: always
paths:
- ./**/*test-result.xml
- ./coverage/Cobertura.xml
- ./coverage/Summary.*
- ./**/*.nupkg
reports:
junit:
- ./**/*test-result.xml
cobertura:
- ./coverage/Cobertura.xml
2021-11-19 03:46:48 +00:00
publish:
stage: release
script:
- nix-shell --run "npm install --ci"
- nix-shell --run "npm run build"
- nix-shell --run "npx semantic-release"
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH