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-nitride-cil/.gitlab-ci.yml
2021-11-18 01:36:13 -06:00

65 lines
2.1 KiB
YAML

# Nix handling based on https://gitlab.com/Vonfry/gitlab-ci-nix/-/blob/master/.gitlab-ci.yml
stages:
- build
- test
- release
variables:
GIT_SUBMODULE_STRATEGY: recursive
LOCAL_NIX_STORE: $CI_PROJECT_DIR/.nix/store
default:
image: nixos/nix:latest
before_script:
- nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
- nix-channel --update
- "[ -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/
build:
stage: build
script:
- nix-shell --run "npm run install --ci"
- nix-shell --run "npx commitlint-gitlab-ci -x @commitlint/config-conventional"
- nix-shell --run "npm run build"
rules:
- if: $CI_COMMIT_BRANCH
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
artifacts:
when: always
paths:
- ./**/*test-result.xml
- ./coverage/Cobertura.xml
- ./coverage/Summary.*
- ./**/*.nupkg
reports:
junit:
- ./**/*test-result.xml
cobertura:
- ./coverage/Cobertura.xml
publish:
stage: release
script:
- nix-shell --run "npm run semantic-release"
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH