Setup CircleCI
authorWonyoung Choi <wy80.choi@samsung.com>
Mon, 30 Mar 2020 04:49:25 +0000 (13:49 +0900)
committerWonyoung Choi <wy80.choi@samsung.com>
Mon, 30 Mar 2020 04:49:25 +0000 (13:49 +0900)
- Build test for every commits and pull requests
- Publish nightly nuget packages for master branch
- Publish release nuget packages by a tag starting with /v[0-9]+/

.circleci/config.yml [new file with mode: 0644]

diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644 (file)
index 0000000..8c2c1a5
--- /dev/null
@@ -0,0 +1,121 @@
+version: 2
+
+jobs:
+
+  build-test:
+    docker:
+      - image: mcr.microsoft.com/dotnet/core/sdk:3.0
+    steps:
+      - checkout
+      - run: curl -sL https://art.sec.samsung.net/artifactory/tools/CircleCI/scripts/set_proxy_setting.sh | sh
+      - run: ./build.sh build
+
+
+  build-nightly:
+    docker:
+      - image: mcr.microsoft.com/dotnet/core/sdk:3.0
+    steps:
+      - checkout
+      - run: curl -sL https://art.sec.samsung.net/artifactory/tools/CircleCI/scripts/set_proxy_setting.sh | sh
+      - run:
+          command: |
+            VERSION=$(./build.sh version nightly)
+            echo ${VERSION} > version.txt
+            ./build.sh build
+            ./build.sh pack ${VERSION}
+      - persist_to_workspace:
+          root: .
+          paths:
+            - XSF.*.nupkg
+            - version.txt
+
+  build-release:
+    docker:
+      - image: mcr.microsoft.com/dotnet/core/sdk:3.0
+    steps:
+      - checkout
+      - run: curl -sL https://art.sec.samsung.net/artifactory/tools/CircleCI/scripts/set_proxy_setting.sh | sh
+      - run:
+          command: |
+            VERSION=$(echo ${CIRCLE_TAG} | sed -e "s/^v//")
+            echo ${VERSION} > version.txt
+            ./build.sh build
+            ./build.sh pack ${VERSION}
+      - persist_to_workspace:
+          root: .
+          paths:
+            - XSF.*.nupkg
+            - version.txt
+
+  deploy:
+    docker:
+      - image: mcr.microsoft.com/dotnet/core/sdk:3.0
+    environment:
+      ART_NUGET_SOURCE: https://art.sec.samsung.net/artifactory/api/nuget/dotnet_nuget
+    steps:
+      - attach_workspace:
+          at: .
+      - run: dotnet nuget push -s ${ART_NUGET_SOURCE} -k ${ART_NUGET_APIKEY} XSF.*.nupkg
+
+  github-release:
+    docker:
+      - image: cibuilds/github:0.10
+    environment:
+      GITHUB_API: https://github.sec.samsung.net/api/v3/
+    steps:
+      - attach_workspace:
+          at: .
+      - run:
+          command: |
+            VERSION=$(cat version.txt)
+            ghr -t ${GITHUB_TOKEN} -u dotnet -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${VERSION} *.nupkg
+
+
+workflows:
+  version: 2
+
+  commit:
+    jobs:
+      - build-test
+
+  nightly:
+    triggers:
+      - schedule:
+          cron: "0 15 * * *"
+          filters:
+            branches:
+              only:
+                - master
+    jobs:
+      - build-nightly
+      - deploy:
+          requires:
+            - build-nightly
+
+  release:
+    jobs:
+      - build-release:
+          filters:
+            tags:
+              only: /^v[0-9]+.*/
+            branches:
+              ignore: /.*/
+      - deploy:
+          requires:
+            - build-release
+          filters:
+            tags:
+              only: /^v[0-9]+.*/
+            branches:
+              ignore: /.*/
+      - github-release:
+          requires:
+            - deploy
+          filters:
+            tags:
+              only: /^v[0-9]+.*/
+            branches:
+              ignore: /.*/
+
+
+