# 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: - "[ -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 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 install --ci" - nix-shell --run "npm run build" - nix-shell --run "npx semantic-release" rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH