diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index bc509685..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,120 +0,0 @@ -version: 2.1 - -jobs: - compliance: - docker: - - image: circleci/python:3.6.4 - working_directory: ~/workdir - steps: - - checkout - - run: - name: compliance check - command: | - pip3 install --user reuse - ~/.local/bin/reuse lint - - ci-node12: - docker: - - image: circleci/node:12 - steps: - - checkout - - run: yarn - - run: yarn ci - - ci-node14: - docker: - - image: circleci/node:14 - working_directory: ~/repo - steps: - - checkout - - run: yarn - - run: yarn ci - - run: mkdir -p artifacts && cp packages/*/*.vsix ./artifacts - # special steps that only need to occur in one of the CI jobs - - run: - name: report_coverage - command: cat ./coverage/lcov.info | ./node_modules/.bin/coveralls - environment: - COVERALLS_SERVICE_NAME: circle-ci - COVERALLS_GIT_BRANCH: ${CIRCLE_BRANCH} - - run: - name: Define environment variable with lastest commit's message - command: | - echo 'export COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")' >> $BASH_ENV - source $BASH_ENV - - run: - name: Lint commit message - command: echo "$COMMIT_MESSAGE" | npx commitlint - # persistence steps needed for deployment jobs - - run: - name: "Inspect Artifacts Folder" - working_directory: ./artifacts - command: ls -la - # persist .vsix for publishing in the `deploy` step - - persist_to_workspace: - root: ./artifacts - paths: - # https://golang.org/pkg/path/filepath/#Match - - app-studio-toolkit-* - - ci-node16: - docker: - - image: circleci/node:16 - steps: - - checkout - - run: yarn - - run: yarn ci - - deploy-gh-releases: - docker: - - image: circleci/golang:1.13 - steps: - - attach_workspace: - at: ./dest - - run: - name: "Publish Release on GitHub" - command: | - go get github.com/tcnksm/ghr - ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} ./dest/ - - deploy-npm: - docker: - - image: circleci/node:14 - working_directory: ~/repo - steps: - - checkout - - run: yarn --pure-lockfile - - run: yarn run ci - - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - # To help debug when lerna detects changes to the working tree and fails the publish - - run: git status - - run: yarn run release:publish - -workflows: - version: 2 - test-deploy: - jobs: - # CI Jobs - - compliance - - ci-node12 - - ci-node14: - filters: - tags: - only: /^v[0-9]+(\.[0-9]+)*/ - - ci-node16 - - # deploy jobs - - deploy-npm: - filters: - tags: - only: /^v[0-9]+(\.[0-9]+)*/ - branches: - ignore: /.*/ - - deploy-gh-releases: - requires: - - ci-node14 - filters: - tags: - only: /^v[0-9]+(\.[0-9]+)*/ - branches: - ignore: /.*/ \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..5f1af69a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: Continuous Integration +on: + # Trigger the workflow on push or pull request, + # but only for the main branch + # See: https://github.community/t/duplicate-checks-on-push-and-pull-request-simultaneous-event/18012 + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Full Build (node ${{ matrix.node_version }}) + runs-on: ubuntu-latest + strategy: + matrix: + node_version: + - 12.x + - 14.x + - 16.x + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + + - name: Install dependencies + run: yarn + + - name: Build + run: yarn run ci + + - name: Report coverage + # coverage should only be reported once per PR/push + if: matrix.node_version == '14.x' + # version is unpinned (should be `v1` === latest v1.x.y) + # see: https://github.com/coverallsapp/github-action/issues/94 + uses: coverallsapp/github-action@1.1.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 00000000..7f991928 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,20 @@ +name: Lint Commit Messages +on: + # Trigger the workflow on push or pull request, + # but only for the main branch + # See: https://github.community/t/duplicate-checks-on-push-and-pull-request-simultaneous-event/18012 + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0b53d3c5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release +on: + push: + tags: + - "v*.*.*" +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + + - name: Install dependencies + run: yarn + + - name: Build + run: yarn run ci + + - name: npm auth setup + run: | + yarn logout + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc + npm whoami + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish to NPM + run: yarn run lerna:publish + + - name: Create Github Release + uses: softprops/action-gh-release@v1 + with: + files: packages/*/*.vsix + fail_on_unmatched_files: true diff --git a/README.md b/README.md index 5e6a74ca..f88a29fe 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -[![CircleCI](https://circleci.com/gh/SAP/app-studio-toolkit.svg?style=svg)](https://circleci.com/gh/SAP/app-studio-toolkit) -[![Coverage Status](https://coveralls.io/repos/github/SAP/app-studio-toolkit/badge.svg?branch=main)](https://coveralls.io/github/SAP/app-studio-toolkit?branch=main) +[![Continuous Integration](https://github.com/SAP/app-studio-toolkit/actions/workflows/ci.yml/badge.svg)](https://github.com/SAP/app-studio-toolkit/actions/workflows/ci.yml) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/SAP/app-studio-toolkit.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/SAP/app-studio-toolkit/context:javascript) +[![Coverage Status](https://coveralls.io/repos/github/SAP/app-studio-toolkit/badge.svg?branch=main)](https://coveralls.io/github/SAP/app-studio-toolkit?branch=main) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![REUSE status](https://api.reuse.software/badge/github.com/SAP/app-studio-toolkit)](https://api.reuse.software/info/github.com/SAP/app-studio-toolkit)