build: switching build to use Nix
This commit is contained in:
parent
40cac44e6d
commit
3ef974f98f
5 changed files with 46 additions and 25 deletions
|
@ -1,22 +1,41 @@
|
||||||
|
# Nix handling based on https://gitlab.com/Vonfry/gitlab-ci-nix/-/blob/master/.gitlab-ci.yml
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
|
||||||
|
variables:
|
||||||
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
LOCAL_NIX_STORE: $CI_PROJECT_DIR/.nix/store
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
image: nixos/nix:latest
|
||||||
before_script:
|
before_script:
|
||||||
- curl -sL https://deb.nodesource.com/setup_15.x | bash -
|
- nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
|
||||||
- apt-get install -y nodejs
|
- 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:
|
build:
|
||||||
image: mcr.microsoft.com/dotnet/sdk:5.0
|
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
# Set up the environment.
|
- nix-shell --run "npm run install --ci"
|
||||||
- npx npm install --ci
|
- nix-shell --run "npx commitlint-gitlab-ci -x @commitlint/config-conventional"
|
||||||
- npx commitlint-gitlab-ci -x @commitlint/config-conventional
|
- nix-shell --run "npm run build"
|
||||||
|
|
||||||
# Build and test everything.
|
rules:
|
||||||
- dotnet restore
|
- if: $CI_COMMIT_BRANCH
|
||||||
- dotnet build
|
|
||||||
|
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"'
|
#- '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.
|
# Summarize the output for Gitlab CI reporting.
|
||||||
|
@ -24,19 +43,6 @@ build:
|
||||||
#- dotnet tool install dotnet-reportgenerator-globaltool
|
#- dotnet tool install dotnet-reportgenerator-globaltool
|
||||||
#- dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
|
#- dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
|
||||||
#- grep "Line coverage" coverage/Summary.txt
|
#- 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
|
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
paths:
|
paths:
|
||||||
|
@ -49,3 +55,10 @@ build:
|
||||||
- ./**/*test-result.xml
|
- ./**/*test-result.xml
|
||||||
cobertura:
|
cobertura:
|
||||||
- ./coverage/Cobertura.xml
|
- ./coverage/Cobertura.xml
|
||||||
|
|
||||||
|
publish:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- nix-shell --run "npm run semantic-release"
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -5,6 +5,7 @@
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
|
"name": "nitride-cil",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^13.1.0",
|
"@commitlint/cli": "^13.1.0",
|
||||||
|
@ -5845,6 +5846,11 @@
|
||||||
"safer-buffer": "^2.0.2",
|
"safer-buffer": "^2.0.2",
|
||||||
"tweetnacl": "~0.14.0"
|
"tweetnacl": "~0.14.0"
|
||||||
},
|
},
|
||||||
|
"bin": {
|
||||||
|
"sshpk-conv": "bin/sshpk-conv",
|
||||||
|
"sshpk-sign": "bin/sshpk-sign",
|
||||||
|
"sshpk-verify": "bin/sshpk-verify"
|
||||||
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "husky install"
|
"prepare": "husky install",
|
||||||
|
"build": "dotnet build",
|
||||||
|
"test": "dotnet test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^13.1.0",
|
"@commitlint/cli": "^13.1.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
branches: ["main"],
|
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: [
|
plugins: [
|
||||||
"@semantic-release/commit-analyzer",
|
"@semantic-release/commit-analyzer",
|
||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
|
|
|
@ -4,7 +4,7 @@ let
|
||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.nodejs-14_x
|
pkgs.nodejs-16_x
|
||||||
pkgs.yarn
|
pkgs.yarn
|
||||||
pkgs.dotnet-sdk_5
|
pkgs.dotnet-sdk_5
|
||||||
pkgs.niv
|
pkgs.niv
|
||||||
|
|
Reference in a new issue