|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +orbs: |
| 4 | + |
| 5 | + |
| 6 | +jobs: |
| 7 | + build_and_test: |
| 8 | + docker: |
| 9 | + - image: mcr.microsoft.com/dotnet/core/sdk:2.2 |
| 10 | + working_directory: ~/workdir |
| 11 | + steps: |
| 12 | + - checkout |
| 13 | + - attach_workspace: |
| 14 | + at: ~/ |
| 15 | + - run: |
| 16 | + name: Generate cache key |
| 17 | + command: | |
| 18 | + shasum src/packages.lock.json \ |
| 19 | + test/CSharpCoverage.Tests/packages.lock.json > /tmp/dependencies.cache.tmp |
| 20 | + - restore_cache: |
| 21 | + keys: |
| 22 | + - nuget-v1-{{ checksum "/tmp/dependencies.cache.tmp" }} |
| 23 | + - nuget-v1- |
| 24 | + - run: |
| 25 | + name: Restore |
| 26 | + command: dotnet restore |
| 27 | + - save_cache: |
| 28 | + key: nuget-v1-{{ checksum "/tmp/dependencies.cache.tmp" }} |
| 29 | + paths: |
| 30 | + - "packages" |
| 31 | + - run: |
| 32 | + name: Compile |
| 33 | + command: dotnet build -c Debug |
| 34 | + - run: |
| 35 | + name: Run tests |
| 36 | + command: dotnet test test/CSharpCoverage.Tests |
| 37 | + - persist_to_workspace: |
| 38 | + root: ~/ |
| 39 | + paths: |
| 40 | + - workdir |
| 41 | + |
| 42 | + build_runtime: |
| 43 | + parameters: |
| 44 | + framework_version: |
| 45 | + type: string |
| 46 | + runtime: |
| 47 | + type: string |
| 48 | + description: "Build to a specific runtime command" |
| 49 | + docker: |
| 50 | + - image: mcr.microsoft.com/dotnet/core/sdk:<< parameters.framework_version >> |
| 51 | + working_directory: ~/workdir |
| 52 | + steps: |
| 53 | + - attach_workspace: |
| 54 | + at: ~/ |
| 55 | + - run: |
| 56 | + name: Install needed packages |
| 57 | + command: | |
| 58 | + apt-get update |
| 59 | + apt-get install -y zip |
| 60 | + - run: |
| 61 | + name: Build for << parameters.runtime >> (netcoreapp<< parameters.framework_version >>) |
| 62 | + command: ./scripts/publish.sh netcoreapp<< parameters.framework_version >> << parameters.runtime >> |
| 63 | + - persist_to_workspace: |
| 64 | + root: ~/ |
| 65 | + paths: |
| 66 | + - workdir/artifacts/ |
| 67 | + |
| 68 | + circleci-artifacts: |
| 69 | + machine: true |
| 70 | + working_directory: ~/workdir |
| 71 | + steps: |
| 72 | + - attach_workspace: |
| 73 | + at: ~/ |
| 74 | + - store_artifacts: |
| 75 | + path: artifacts/ |
| 76 | + |
| 77 | + github-release: |
| 78 | + docker: |
| 79 | + - image: cibuilds/github:0.12.2 |
| 80 | + working_directory: ~/workdir |
| 81 | + steps: |
| 82 | + - attach_workspace: |
| 83 | + at: ~/ |
| 84 | + - run: |
| 85 | + name: "Publish Release on GitHub" |
| 86 | + command: | |
| 87 | + GHR_FLAGS="" |
| 88 | + if [ "${CIRCLE_BRANCH}" != "master" ]; then |
| 89 | + GHR_FLAGS+="-prerelease" |
| 90 | + fi |
| 91 | + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${GHR_FLAGS} -delete $(cat .version) ./artifacts/ |
| 92 | +
|
| 93 | +workflows: |
| 94 | + version: 2 |
| 95 | + build-and-deploy: |
| 96 | + jobs: |
| 97 | + - codacy/checkout_and_version |
| 98 | + - build_and_test: |
| 99 | + requires: |
| 100 | + - codacy/checkout_and_version |
| 101 | + - build_runtime: |
| 102 | + name: build_runtime_2.2_linux-x64 |
| 103 | + framework_version: "2.2" |
| 104 | + runtime: linux-x64 |
| 105 | + requires: |
| 106 | + - build_and_test |
| 107 | + - build_runtime: |
| 108 | + name: build_runtime_2.2_linux-musl-x64 |
| 109 | + framework_version: "2.2" |
| 110 | + runtime: linux-musl-x64 |
| 111 | + requires: |
| 112 | + - build_and_test |
| 113 | + - build_runtime: |
| 114 | + name: build_runtime_2.2_osx-x64 |
| 115 | + framework_version: "2.2" |
| 116 | + runtime: osx-x64 |
| 117 | + requires: |
| 118 | + - build_and_test |
| 119 | + - build_runtime: |
| 120 | + name: build_runtime_2.2_win-x64 |
| 121 | + framework_version: "2.2" |
| 122 | + runtime: win-x64 |
| 123 | + requires: |
| 124 | + - build_and_test |
| 125 | + - build_runtime: |
| 126 | + name: build_runtime_2.2_win-x86 |
| 127 | + framework_version: "2.2" |
| 128 | + runtime: win-x86 |
| 129 | + requires: |
| 130 | + - build_and_test |
| 131 | + - build_runtime: |
| 132 | + name: build_runtime_3.0_linux-x64 |
| 133 | + framework_version: "3.0" |
| 134 | + runtime: linux-x64 |
| 135 | + requires: |
| 136 | + - build_and_test |
| 137 | + - build_runtime: |
| 138 | + name: build_runtime_3.0_linux-musl-x64 |
| 139 | + framework_version: "3.0" |
| 140 | + runtime: linux-musl-x64 |
| 141 | + requires: |
| 142 | + - build_and_test |
| 143 | + - build_runtime: |
| 144 | + name: build_runtime_3.0_osx-x64 |
| 145 | + framework_version: "3.0" |
| 146 | + runtime: osx-x64 |
| 147 | + requires: |
| 148 | + - build_and_test |
| 149 | + - build_runtime: |
| 150 | + name: build_runtime_3.0_win-x64 |
| 151 | + framework_version: "3.0" |
| 152 | + runtime: win-x64 |
| 153 | + requires: |
| 154 | + - build_and_test |
| 155 | + - build_runtime: |
| 156 | + name: build_runtime_3.0_win-x86 |
| 157 | + framework_version: "3.0" |
| 158 | + runtime: win-x86 |
| 159 | + requires: |
| 160 | + - build_and_test |
| 161 | + - circleci-artifacts: |
| 162 | + requires: |
| 163 | + - build_runtime_2.2_win-x86 |
| 164 | + - build_runtime_2.2_win-x64 |
| 165 | + - build_runtime_2.2_osx-x64 |
| 166 | + - build_runtime_2.2_linux-musl-x64 |
| 167 | + - build_runtime_2.2_linux-x64 |
| 168 | + - build_runtime_3.0_win-x86 |
| 169 | + - build_runtime_3.0_win-x64 |
| 170 | + - build_runtime_3.0_osx-x64 |
| 171 | + - build_runtime_3.0_linux-musl-x64 |
| 172 | + - build_runtime_3.0_linux-x64 |
| 173 | + # - build_and_coverage |
| 174 | + - github-release: |
| 175 | + context: CodacyGitHub |
| 176 | + requires: |
| 177 | + - build_runtime_2.2_win-x86 |
| 178 | + - build_runtime_2.2_win-x64 |
| 179 | + - build_runtime_2.2_osx-x64 |
| 180 | + - build_runtime_2.2_linux-musl-x64 |
| 181 | + - build_runtime_2.2_linux-x64 |
| 182 | + - build_runtime_3.0_win-x86 |
| 183 | + - build_runtime_3.0_win-x64 |
| 184 | + - build_runtime_3.0_osx-x64 |
| 185 | + - build_runtime_3.0_linux-musl-x64 |
| 186 | + - build_runtime_3.0_linux-x64 |
| 187 | + # - build_and_coverage |
| 188 | + filters: |
| 189 | + branches: |
| 190 | + only: master |
0 commit comments