diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d3baaeb68..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,143 +0,0 @@ -version: 2.1 - -aliases: - - &working_directory ~/nodejs - -executors: - node_18: - docker: - - image: cimg/node:18.18.0 - working_directory: *working_directory - node_20: - docker: - - image: cimg/node:20.9.0 - working_directory: *working_directory - - node_22: - docker: - - image: cimg/node:22.14.0 - working_directory: *working_directory - -commands: - pnpm_install: - description: Installs dependencies using PNPM - parameters: - pnpm_store_dir: - type: string - default: /home/circleci/.local/share/pnpm/store - pnpm_install_directory: - type: string - default: /home/circleci/bin - command: - type: string - default: pnpm install --frozen-lockfile - steps: - - restore_cache: - name: Restoring pnpm cache - keys: - # Delete and re-create a increased `CACHE_VERSION_PNPM` variable in CircleCI's project configuration. - # https://app.circleci.com/settings/project/github/commercetools/nodejs/environment-variables - - pnpm-cache-{{ .Environment.CACHE_VERSION_PNPM }}-{{ checksum "pnpm-lock.yaml" }} - - run: - name: Ensuring pnpm installation directory exists - command: mkdir -p << parameters.pnpm_install_directory >> - - run: - name: Exporting << parameters.pnpm_install_directory >> to PATH - command: echo 'export PATH=$PATH:<< parameters.pnpm_install_directory >>' >> $BASH_ENV - - run: - name: Installing pnpm via corepack - command: | - corepack enable --install-directory << parameters.pnpm_install_directory >> - corepack prepare --activate - - run: - name: Setting pnpm store - command: pnpm config set store-dir << parameters.pnpm_store_dir >> - - save_cache: - name: Saving pnpm cache - key: pnpm-cache-{{ .Environment.CACHE_VERSION_PNPM }}-{{ checksum "pnpm-lock.yaml" }} - paths: - - node_modules - - run: - name: Installing project dependencies - command: << parameters.command >> - -jobs: - install_test_node_18: - executor: node_18 - steps: - - checkout - - pnpm_install - - run: - name: Building libraries - command: pnpm build - - run: - name: Running linters - # Limiting the workers of Jest to 10 - # as the build otherwise dies due to resource restrictions. - command: pnpm lint --maxWorkers=10 - - run: - name: Running tests - # Limiting the workers of Jest to 10 - # as the build otherwise dies due to resource restrictions. - command: pnpm test:ci - - run: - name: Running test (with coverage report) - command: pnpm test:ci - - install_test_node_20: - executor: node_20 - steps: - - checkout - - pnpm_install - - run: - name: Building libraries - command: pnpm build - - run: - name: Running linters - # Limiting the workers of Jest to 10 - # as the build otherwise dies due to resource restrictions. - command: pnpm lint --maxWorkers=10 - - run: - name: Running tests (with coverage report) - # Limiting the workers of Jest to 10 - # as the build otherwise dies due to resource restrictions. - command: pnpm test:coverage:ci - - run: - name: Running integration tests - command: pnpm test:integration - - install_test_node_22: - executor: node_22 - steps: - - checkout - - pnpm_install - - run: - name: Building libraries - command: pnpm build - - run: - name: Running linters - # Limiting the workers of Jest to 10 - # as the build otherwise dies due to resource restrictions. - command: pnpm lint --maxWorkers=10 - - run: - name: Running tests (with coverage report) - # Limiting the workers of Jest to 10 - # as the build otherwise dies due to resource restrictions. - command: pnpm test:coverage:ci - - run: - name: Running integration tests - command: pnpm test:integration - -workflows: - build_and_test: - jobs: - - install_test_node_18: - context: org-global - - install_test_node_20: - context: org-global - requires: - - install_test_node_18 - - install_test_node_22: - context: org-global - requires: - - install_test_node_20 diff --git a/.github/actions/ci/action.yml b/.github/actions/ci/action.yml new file mode 100644 index 000000000..f866412d1 --- /dev/null +++ b/.github/actions/ci/action.yml @@ -0,0 +1,22 @@ +name: CI + +description: Shared action to install dependencies + +runs: + using: composite + + steps: + - name: Install pnpm + uses: pnpm/action-setup@v4.1.0 + with: + run_install: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "pnpm" + + - name: Install + run: pnpm install + shell: bash diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 000000000..c7ce8ad00 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,95 @@ +name: Quality + +on: + push: + branches: + - master + pull_request: + +jobs: + linting: + name: Linting + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/ci + + - name: Lint + run: pnpm lint + + type-checking: + name: Type checking + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/ci + + - name: TypeScript + run: pnpm typecheck:ts + + - name: Flow + run: pnpm typecheck:flow + + testing: + name: Testing + needs: [linting, type-checking] + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/ci + + - name: Build + run: pnpm build + + - uses: oNaiPs/secrets-to-env-action@v1 + with: + secrets: ${{ toJSON(secrets) }} + + - name: Test (with coverage) + run: pnpm test:coverage:ci + + - name: Integration tests + run: pnpm test:integration + + regression-testing: + name: Regression Testing + needs: [testing] + runs-on: ubuntu-latest + strategy: + matrix: + version: [18, 20] + fail-fast: true + max-parallel: 1 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/ci + + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.version }} + + - name: Build + run: pnpm build + + - uses: oNaiPs/secrets-to-env-action@v1 + with: + secrets: ${{ toJSON(secrets) }} + + - name: Integration tests + run: pnpm test:integration diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9c7483b6..0570f1e97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,19 +26,8 @@ jobs: # https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8 token: ${{ steps.generate_github_token.outputs.token }} - - name: Install pnpm - uses: pnpm/action-setup@v4.1.0 - with: - run_install: false - - - name: Setup Node (uses version in .nvmrc) - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile + - name: Setup + uses: ./.github/actions/ci - name: Creating .npmrc run: | diff --git a/docs/README.md b/docs/README.md index b10c51538..b8458aa6d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,15 +6,12 @@

- - Travis CI Status + + GitHub Actions Status Codecov - - Waffle.io Board -

The **commercetools nodejs** repo is managed as a [monorepo](https://github.com/lerna/lerna) and contains different npm packages. diff --git a/docs/cli/csv-parser-orders.md b/docs/cli/csv-parser-orders.md index 91aa44884..292bfbd1c 100644 --- a/docs/cli/csv-parser-orders.md +++ b/docs/cli/csv-parser-orders.md @@ -1,6 +1,6 @@ # CSV Parser Orders -[![Travis Build Status][travis-icon]][travis] +[![GitHub Actions Status][github-actions-icon]][github-actions] [![Codecov Coverage Status][codecov-icon]][codecov] [![David Dependencies Status][david-icon]][david] [![David devDependencies Status][david-dev-icon]][david-dev] @@ -468,8 +468,8 @@ More delivery examples can be seen [here](https://github.com/commercetools/nodej [commercetools]: https://commercetools.com/ [commercetools-icon]: https://cdn.rawgit.com/commercetools/press-kit/master/PNG/72DPI/CT%20logo%20horizontal%20RGB%2072dpi.png -[travis]: https://travis-ci.org/commercetools/csv-parser-orders -[travis-icon]: https://img.shields.io/travis/commercetools/csv-parser-orders/master.svg?style=flat-square +[github-actions]: https://github.com/commercetools/nodejs/actions/workflows/quality.yml +[github-actions-icon]: https://github.com/commercetools/nodejs/actions/workflows/quality.yml/badge.svg [codecov]: https://codecov.io/gh/commercetools/csv-parser-orders [codecov-icon]: https://img.shields.io/codecov/c/github/commercetools/csv-parser-orders.svg?style=flat-square [david]: https://david-dm.org/commercetools/csv-parser-orders diff --git a/docs/cli/csv-parser-price.md b/docs/cli/csv-parser-price.md index bc87b39b2..8526a89d5 100644 --- a/docs/cli/csv-parser-price.md +++ b/docs/cli/csv-parser-price.md @@ -1,6 +1,6 @@ # CSV Parser Price -[![Travis Build Status][travis-icon]][travis] +[![GitHub Actions Status][github-actions-icon]][github-actions] [![Codecov Coverage Status][codecov-icon]][codecov] [![David Dependencies Status][david-icon]][david] [![David devDependencies Status][david-dev-icon]][david-dev] @@ -181,8 +181,8 @@ JSON object returned from the conversion of the CSV file above [commercetools]: https://commercetools.com/ [commercetools-icon]: https://cdn.rawgit.com/commercetools/press-kit/master/PNG/72DPI/CT%20logo%20horizontal%20RGB%2072dpi.png -[travis]: https://travis-ci.org/commercetools/csv-parser-price -[travis-icon]: https://img.shields.io/travis/commercetools/csv-parser-price/master.svg?style=flat-square +[github-actions]: https://github.com/commercetools/nodejs/actions/workflows/quality.yml +[github-actions-icon]: https://github.com/commercetools/nodejs/actions/workflows/quality.yml/badge.svg [codecov]: https://codecov.io/gh/commercetools/csv-parser-price [codecov-icon]: https://img.shields.io/codecov/c/github/commercetools/csv-parser-price.svg?style=flat-square [david]: https://david-dm.org/commercetools/csv-parser-price