|
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 |
| - |
16 |
| - dotnet-gitversion | jq '.BranchName' > ./semver/branch.txt |
17 |
| - dotnet-gitversion | jq '.SemVer' > ./semver/full.txt |
18 |
| - dotnet-gitversion | jq '.NuGetVersionV2' > ./semver/nuget.txt |
19 |
| - dotnet-gitversion | jq '.NuGetPreReleaseTagV2' > ./semver/nuget-sfx.txt |
20 |
| - dotnet-gitversion | jq '.MajorMinorPatch' > ./semver/mmp.txt |
21 |
| - |
22 |
| - export BRANCH=$(cat ./semver/branch.txt) |
23 |
| - echo $BRANCH |
24 |
| - |
25 |
| - export V=\"$(git describe --tags --abbrev=0)\" |
26 |
| - echo $V |
27 |
| - |
28 |
| - cp ./semver/nuget.txt ./semver/version.txt |
29 |
| - |
30 |
| - if [[ $BRANCH == "\"(no branch)\"" ]]; then echo "tagged release"; echo $V > ./semver/version.txt; fi; |
31 |
| -
|
32 |
| - cat ./semver/version.txt |
33 |
| - |
34 |
| - ls |
35 |
| - ls ./semver |
36 |
| -
|
37 |
| - - persist_to_workspace: |
38 |
| - root: . |
39 |
| - paths: |
40 |
| - - src |
41 |
| - - semver |
42 |
| - |
43 |
| - build: |
44 |
| - docker: |
45 |
| - - image: mcr.microsoft.com/dotnet/sdk:6.0 |
46 |
| - steps: |
47 |
| - - attach_workspace: |
48 |
| - at: ./ |
49 |
| - - run: |
50 |
| - name: build |
51 |
| - command: | |
52 |
| - |
53 |
| - ls |
54 |
| - ls ./semver |
55 |
| - APP_VERSION=$(cat ./semver/version.txt) |
56 |
| - echo $APP_VERSION |
57 |
| -
|
58 |
| - cd ./src |
59 |
| - ls |
60 |
| -
|
61 |
| - dotnet restore --packages packages |
62 |
| - dotnet build --no-restore --configuration Release --force -p:Version=$APP_VERSION |
63 |
| -
|
64 |
| - mkdir ./../nupkgs |
65 |
| - mv ./**/bin/**/*.nupkg ./../nupkgs |
66 |
| -
|
67 |
| - cd ./../nupkgs |
68 |
| - rm *.symbols.nupkg |
69 |
| - pwd |
70 |
| - ls |
71 |
| -
|
72 |
| - - persist_to_workspace: |
73 |
| - root: . |
74 |
| - paths: |
75 |
| - - nupkgs |
76 |
| - - src |
77 |
| - |
78 |
| - test: |
79 |
| - docker: |
80 |
| - - image: mcr.microsoft.com/dotnet/sdk:6.0 |
81 |
| - steps: |
82 |
| - - attach_workspace: |
83 |
| - at: ./ |
84 |
| - - run: |
85 |
| - name: test |
86 |
| - command: | |
87 |
| - mkdir ./results |
88 |
| - |
89 |
| - cd src |
90 |
| - dotnet test --no-restore --no-build --configuration Release --logger trx --results-directory ../results /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.*Tests]*" |
91 |
| - 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; |
92 |
| - cd ../results |
93 |
| - ls |
94 |
| -
|
95 |
| - - persist_to_workspace: |
96 |
| - root: . |
97 |
| - paths: |
98 |
| - - results |
99 |
| - - src |
100 |
| - - store_artifacts: |
101 |
| - path: results |
102 |
| - |
103 |
| - upload_result: |
104 |
| - docker: |
105 |
| - - image: dboneslabs/tools-docker-codecov |
106 |
| - steps: |
107 |
| - - attach_workspace: |
108 |
| - at: ./results |
109 |
| - - run: | |
110 |
| - cd results |
111 |
| - REPORTS="${PWD}/*.xml" |
112 |
| - cp /app/* ${PWD}/ |
113 |
| - ls |
114 |
| - echo "uploading ${REPORTS}" |
115 |
| - ./codecov.sh -f "${REPORTS}" |
116 |
| -
|
117 |
| - publish: |
118 |
| - docker: |
119 |
| - - image: mcr.microsoft.com/dotnet/sdk:6.0 |
120 |
| - steps: |
121 |
| - - attach_workspace: |
122 |
| - at: ./ |
123 |
| - - run: | |
124 |
| -
|
125 |
| - pwd |
126 |
| - cd nupkgs |
127 |
| - ls |
128 |
| - |
129 |
| - dotnet nuget push "*.nupkg" -k ${GH_PKG} -s https://nuget.pkg.github.com/dbones-labs/index.json |
130 |
| - dotnet nuget push "*.nupkg" -k ${nuget_pkg} -s https://api.nuget.org/v3/index.json |
131 |
| -
|
132 |
| -workflows: |
133 |
| - version: 2 |
134 |
| - build_and_publish: |
135 |
| - jobs: |
136 |
| - - setup: |
137 |
| - filters: |
138 |
| - branches: |
139 |
| - ignore: |
140 |
| - - docs |
141 |
| - - build: |
142 |
| - requires: |
143 |
| - - setup |
144 |
| - - test: |
145 |
| - requires: |
146 |
| - - build |
147 |
| - - upload_result: |
148 |
| - context: build-ctx |
149 |
| - requires: |
150 |
| - - test |
151 |
| - filters: |
152 |
| - branches: |
153 |
| - only: master |
154 |
| - - publish: |
155 |
| - context: build-ctx |
156 |
| - requires: |
157 |
| - - test |
| 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 | + |
| 16 | + dotnet-gitversion | jq '.BranchName' > ./semver/branch.txt |
| 17 | + dotnet-gitversion | jq '.SemVer' > ./semver/full.txt |
| 18 | + dotnet-gitversion | jq '.NuGetVersionV2' > ./semver/nuget.txt |
| 19 | + dotnet-gitversion | jq '.NuGetPreReleaseTagV2' > ./semver/nuget-sfx.txt |
| 20 | + dotnet-gitversion | jq '.MajorMinorPatch' > ./semver/mmp.txt |
| 21 | + |
| 22 | + export BRANCH=$(cat ./semver/branch.txt) |
| 23 | + echo $BRANCH |
| 24 | + |
| 25 | + export V=\"$(git describe --tags --abbrev=0)\" |
| 26 | + echo $V |
| 27 | + |
| 28 | + cp ./semver/nuget.txt ./semver/version.txt |
| 29 | + |
| 30 | + if [[ $BRANCH == "\"(no branch)\"" ]]; then echo "tagged release"; echo $V > ./semver/version.txt; fi; |
| 31 | +
|
| 32 | + cat ./semver/version.txt |
| 33 | + |
| 34 | + ls |
| 35 | + ls ./semver |
| 36 | +
|
| 37 | + - persist_to_workspace: |
| 38 | + root: . |
| 39 | + paths: |
| 40 | + - src |
| 41 | + - semver |
| 42 | + |
| 43 | + build: |
| 44 | + docker: |
| 45 | + - image: mcr.microsoft.com/dotnet/sdk:6.0 |
| 46 | + steps: |
| 47 | + - attach_workspace: |
| 48 | + at: ./ |
| 49 | + - run: |
| 50 | + name: build |
| 51 | + command: | |
| 52 | + |
| 53 | + ls |
| 54 | + ls ./semver |
| 55 | + APP_VERSION=$(cat ./semver/version.txt) |
| 56 | + echo $APP_VERSION |
| 57 | +
|
| 58 | + cd ./src |
| 59 | + ls |
| 60 | +
|
| 61 | + dotnet restore --packages packages |
| 62 | + dotnet build --no-restore --configuration Release --force -p:Version=$APP_VERSION |
| 63 | +
|
| 64 | + mkdir ./../nupkgs |
| 65 | + mv ./**/bin/**/*.nupkg ./../nupkgs |
| 66 | +
|
| 67 | + cd ./../nupkgs |
| 68 | + rm *.symbols.nupkg |
| 69 | + pwd |
| 70 | + ls |
| 71 | +
|
| 72 | + - persist_to_workspace: |
| 73 | + root: . |
| 74 | + paths: |
| 75 | + - nupkgs |
| 76 | + - src |
| 77 | + |
| 78 | + test: |
| 79 | + docker: |
| 80 | + - image: mcr.microsoft.com/dotnet/sdk:6.0 |
| 81 | + steps: |
| 82 | + - attach_workspace: |
| 83 | + at: ./ |
| 84 | + - run: |
| 85 | + name: test |
| 86 | + command: | |
| 87 | + mkdir ./results |
| 88 | + |
| 89 | + cd src |
| 90 | + dotnet test --no-restore --no-build --configuration Release --logger trx --results-directory ../results /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.*Tests]*" |
| 91 | + 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; |
| 92 | + cd ../results |
| 93 | + ls |
| 94 | +
|
| 95 | + - persist_to_workspace: |
| 96 | + root: . |
| 97 | + paths: |
| 98 | + - results |
| 99 | + - src |
| 100 | + - store_artifacts: |
| 101 | + path: results |
| 102 | + |
| 103 | + upload_result: |
| 104 | + docker: |
| 105 | + - image: dboneslabs/tools-docker-codecov |
| 106 | + steps: |
| 107 | + - attach_workspace: |
| 108 | + at: ./results |
| 109 | + - run: | |
| 110 | + cd results |
| 111 | + REPORTS="${PWD}/*.xml" |
| 112 | + cp /app/* ${PWD}/ |
| 113 | + ls |
| 114 | + echo "uploading ${REPORTS}" |
| 115 | + ./codecov.sh -f "${REPORTS}" |
| 116 | +
|
| 117 | + publish: |
| 118 | + docker: |
| 119 | + - image: mcr.microsoft.com/dotnet/sdk:6.0 |
| 120 | + steps: |
| 121 | + - attach_workspace: |
| 122 | + at: ./ |
| 123 | + - run: | |
| 124 | +
|
| 125 | + pwd |
| 126 | + cd nupkgs |
| 127 | + ls |
| 128 | + |
| 129 | + dotnet nuget push "*.nupkg" -k ${GH_PKG} -s https://nuget.pkg.github.com/dbones-labs/index.json |
| 130 | + dotnet nuget push "*.nupkg" -k ${nuget_pkg} -s https://api.nuget.org/v3/index.json |
| 131 | +
|
| 132 | +workflows: |
| 133 | + version: 2 |
| 134 | + build_and_publish: |
| 135 | + jobs: |
| 136 | + - setup: |
| 137 | + filters: |
| 138 | + branches: |
| 139 | + ignore: |
| 140 | + - docs |
| 141 | + - build: |
| 142 | + requires: |
| 143 | + - setup |
| 144 | + - test: |
| 145 | + requires: |
| 146 | + - build |
| 147 | + - upload_result: |
| 148 | + context: build-ctx |
| 149 | + requires: |
| 150 | + - test |
| 151 | + filters: |
| 152 | + branches: |
| 153 | + only: master |
| 154 | + - publish: |
| 155 | + context: build-ctx |
| 156 | + requires: |
| 157 | + - test |
0 commit comments