1- version : 2.1
2-
3- jobs :
4-
5- setup :
6- docker :
7- - image : dboneslabs/tools-docker-gittools:latest
8- steps :
9- - checkout
10- - run :
11- name : version
12- command : |
13- mkdir semver
14- dotnet-gitversion
15- dotnet-gitversion | jq '.SemVer' > ./semver/full.txt
16- dotnet-gitversion | jq '.NuGetVersionV2' > ./semver/nuget.txt
17- dotnet-gitversion | jq '.NuGetPreReleaseTagV2' > ./semver/nuget-sfx.txt
18- dotnet-gitversion | jq '.MajorMinorPatch' > ./semver/mmp.txt
19- ls
20- ls ./semver
21-
22- - persist_to_workspace :
23- root : .
24- paths :
25- - src
26- - semver
27-
28- build :
29- docker :
30- - image : mcr.microsoft.com/dotnet/core/sdk:3.1
31- steps :
32- - attach_workspace :
33- at : ./
34- - run :
35- name : build
36- command : |
37-
38- ls
39- ls ./semver
40- APP_VERSION=$(cat ./semver/nuget.txt)
41- echo $APP_VERSION
42-
43- export SEMVER_NUGET_SFX=$(cat ./semver/nuget-sfx.txt)
44- echo $SEMVER_NUGET_SFX
45-
46- cd src
47- ls
48-
49- dotnet restore --packages packages
50- dotnet build --no-restore --configuration Release --force -p:Version=$APP_VERSION
51-
52- mkdir ./../nupkgs
53- mv **/bin/**/*.nupkg ./../nupkgs
54-
55- cd ./../nupkgs
56- rm *.symbols.nupkg
57- pwd
58- ls
59-
60- - persist_to_workspace :
61- root : .
62- paths :
63- - nupkgs
64- - src
65-
66- test :
67- docker :
68- - image : mcr.microsoft.com/dotnet/core/sdk:3.1
69- steps :
70- - attach_workspace :
71- at : ./
72- - run :
73- name : test
74- command : |
75- mkdir ./results
76-
77- cd src
78- dotnet test --no-restore --no-build --configuration Release --logger trx --results-directory ../results /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.*Tests]*"
79- find . -type f -name "coverage.opencover.xml" -printf "/%P\n"| while read FILE ; do DIR=$(dirname "$FILE" ); mv ."$FILE" "$PWD"/../results"$DIR".coverage.opencover.xml;done;
80-
81- cd ../results
82- ls
83-
84- - persist_to_workspace :
85- root : .
86- paths :
87- - results
88- - src
89- - store_artifacts :
90- path : results
91-
92- upload_result :
93- docker :
94- - image : dboneslabs/tools-docker-codecov
95- steps :
96- - attach_workspace :
97- at : ./results
98- - run : |
99- cd results
100- REPORTS="${PWD}/*.xml"
101- cp /app/* ${PWD}/
102- ls
103-
104- echo "uploading ${REPORTS}"
105- ./codecov.sh -f "${REPORTS}"
106-
107- publish :
108- docker :
109- - image : mcr.microsoft.com/dotnet/core/sdk:3.1
110- steps :
111- - attach_workspace :
112- at : ./
113- - run : |
114-
115- pwd
116- cd nupkgs
117- ls
118-
119- dotnet nuget add source https://nuget.pkg.github.com/dbones-labs/index.json -n github -u dbones -p ${GH_TOKEN} --store-password-in-clear-text
120- dotnet nuget push "*.nupkg" --source "github"
121-
122- workflows :
123- version : 2
124- build_and_publish :
125- jobs :
126- - setup :
127- filters :
128- branches :
129- ignore :
130- - docs
131- - build :
132- requires :
133- - setup
134- - test :
135- requires :
136- - build
137- - upload_result :
138- context : build-ctx
139- requires :
140- - test
141- filters :
142- branches :
143- only : master
144- - publish :
145- context : build-ctx
146- requires :
1+ version : 2.1
2+
3+ jobs :
4+
5+ setup :
6+ docker :
7+ - image : dboneslabs/tools-docker-gittools:latest
8+ steps :
9+ - checkout
10+ - run :
11+ name : version
12+ command : |
13+ mkdir semver
14+ dotnet-gitversion
15+ dotnet-gitversion | jq '.SemVer' > ./semver/full.txt
16+ dotnet-gitversion | jq '.NuGetVersionV2' > ./semver/nuget.txt
17+ dotnet-gitversion | jq '.NuGetPreReleaseTagV2' > ./semver/nuget-sfx.txt
18+ dotnet-gitversion | jq '.MajorMinorPatch' > ./semver/mmp.txt
19+ ls
20+ ls ./semver
21+
22+ - persist_to_workspace :
23+ root : .
24+ paths :
25+ - src
26+ - semver
27+
28+ build :
29+ docker :
30+ - image : mcr.microsoft.com/dotnet/core/sdk:3.1
31+ steps :
32+ - attach_workspace :
33+ at : ./
34+ - run :
35+ name : build
36+ command : |
37+
38+ ls
39+ ls ./semver
40+ APP_VERSION=$(cat ./semver/nuget.txt)
41+ echo $APP_VERSION
42+
43+ export SEMVER_NUGET_SFX=$(cat ./semver/nuget-sfx.txt)
44+ echo $SEMVER_NUGET_SFX
45+
46+ cd src
47+ ls
48+
49+ dotnet restore --packages packages
50+ dotnet build --no-restore --configuration Release --force -p:Version=$APP_VERSION
51+
52+ mkdir ./../nupkgs
53+ mv **/bin/**/*.nupkg ./../nupkgs
54+
55+ cd ./../nupkgs
56+ rm *.symbols.nupkg
57+ pwd
58+ ls
59+
60+ - persist_to_workspace :
61+ root : .
62+ paths :
63+ - nupkgs
64+ - src
65+
66+ test :
67+ docker :
68+ - image : mcr.microsoft.com/dotnet/core/sdk:3.1
69+ steps :
70+ - attach_workspace :
71+ at : ./
72+ - run :
73+ name : test
74+ command : |
75+ mkdir ./results
76+
77+ cd src
78+ dotnet test --no-restore --no-build --configuration Release --logger trx --results-directory ../results /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.*Tests]*"
79+ find . -type f -name "coverage.opencover.xml" -printf "/%P\n"| while read FILE ; do DIR=$(dirname "$FILE" ); mv ."$FILE" "$PWD"/../results"$DIR".coverage.opencover.xml;done;
80+
81+ cd ../results
82+ ls
83+
84+ - persist_to_workspace :
85+ root : .
86+ paths :
87+ - results
88+ - src
89+ - store_artifacts :
90+ path : results
91+
92+ upload_result :
93+ docker :
94+ - image : dboneslabs/tools-docker-codecov
95+ steps :
96+ - attach_workspace :
97+ at : ./results
98+ - run : |
99+ cd results
100+ REPORTS="${PWD}/*.xml"
101+ cp /app/* ${PWD}/
102+ ls
103+
104+ echo "uploading ${REPORTS}"
105+ ./codecov.sh -f "${REPORTS}"
106+
107+ publish :
108+ docker :
109+ - image : mcr.microsoft.com/dotnet/core/sdk:3.1
110+ steps :
111+ - attach_workspace :
112+ at : ./
113+ - run : |
114+
115+ pwd
116+ cd nupkgs
117+ ls
118+
119+ dotnet nuget add source https://nuget.pkg.github.com/dbones-labs/index.json -n github -u dbones -p ${GH_TOKEN} --store-password-in-clear-text
120+ dotnet nuget push "*.nupkg" --source "github"
121+
122+ workflows :
123+ version : 2
124+ build_and_publish :
125+ jobs :
126+ - setup :
127+ filters :
128+ branches :
129+ ignore :
130+ - docs
131+ - build :
132+ requires :
133+ - setup
134+ - test :
135+ requires :
136+ - build
137+ - upload_result :
138+ context : build-ctx
139+ requires :
140+ - test
141+ filters :
142+ branches :
143+ only : master
144+ - publish :
145+ context : build-ctx
146+ requires :
147147 - test
0 commit comments