diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8da53617..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,179 +0,0 @@ -version: 2.1 -orbs: - codecov: codecov/codecov@3.2.2 - gh: circleci/github-cli@2.2.0 - browser-tools: circleci/browser-tools@1.4.8 - -jobs: - install_dependencies: - docker: - - image: cimg/node:18.17.0-browsers - working_directory: ~/login-workflow - resource_class: large - steps: - - checkout - - restore_cache: - keys: - - v2-dependencies-{{ checksum "login-workflow/yarn.lock" }} - - run: - name: Install Dependencies - command: | - cd login-workflow - yarn install --frozen-lockfile - - save_cache: - name: Save Cache - paths: - - node_modules - key: v2-dependencies-{{ checksum "login-workflow/yarn.lock" }} - - prettier_check: - docker: - - image: cimg/node:18.17.0-browsers - working_directory: ~/login-workflow - resource_class: large - steps: - - checkout - - restore_cache: - keys: - - v2-dependencies-{{ checksum "login-workflow/yarn.lock" }} - - run: - name: Install Dependencies - command: | - cd login-workflow - yarn install --frozen-lockfile - - run: - name: Prettier Check - command: | - cd login-workflow - yarn prettier:check - - lint_check: - docker: - - image: cimg/node:18.17.0-browsers - environment: - NODE_OPTIONS=--max-old-space-size=5120 - working_directory: ~/login-workflow - resource_class: large - steps: - - checkout - - restore_cache: - keys: - - v2-dependencies-{{ checksum "login-workflow/yarn.lock" }} - - run: - name: Install Dependencies - command: | - cd login-workflow - yarn install --frozen-lockfile - - run: - name: Lint - command: | - cd login-workflow - yarn lint - - store_test_results: - docker: - - image: cimg/node:18.17.0-browsers - parallelism: 4 - working_directory: ~/login-workflow - resource_class: large - steps: - - checkout - - restore_cache: - keys: - - v2-dependencies-{{ checksum "login-workflow/yarn.lock" }} - - run: - name: Install Dependencies - command: | - cd login-workflow - yarn install --frozen-lockfile - - run: - name: Tests - command: | - cd login-workflow - yarn test:ci --maxWorkers=2 --coverage --watchAll=false - - persist_to_workspace: - root: . - paths: - - login-workflow/coverage - - build_login_workflow: - docker: - - image: cimg/node:18.17.0-browsers - environment: - NODE_OPTIONS=--max-old-space-size=5120 - working_directory: ~/login-workflow - resource_class: large - steps: - - checkout - - restore_cache: - keys: - - v2-dependencies-{{ checksum "login-workflow/yarn.lock" }} - - run: - name: Install Dependencies - command: | - cd login-workflow - yarn install --frozen-lockfile - - run: - name: Build - command: | - cd login-workflow - yarn build - - persist_to_workspace: - root: . - paths: - - login-workflow/dist - - coverage_report: - working_directory: ~/login-workflow - docker: - - image: cimg/node:18.17.0-browsers - steps: - - checkout - - attach_workspace: - at: . - - codecov/upload: - file: './login-workflow/coverage/clover.xml' - flags: unit_tests - token: CODECOV_TOKEN - - publish_login_workflow: - docker: - - image: cimg/node:18.17.0-browsers - steps: - - checkout - - attach_workspace: - at: . - - run: - name: Authenticate with registry - command: | - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc - echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc - - run: - name: Publish @brightlayer-ui/react-auth-workflow - command: | - cd login-workflow && yarn publish:package -b $CIRCLE_BRANCH - -workflows: - react_workflows: - jobs: - - install_dependencies - - prettier_check - - lint_check - - store_test_results - - build_login_workflow - - publish_login_workflow: - requires: - - build_login_workflow - filters: - branches: - only: - - master - - dev - - coverage_report: - requires: - - store_test_results - filters: - branches: - only: - - master - - dev diff --git a/.github/workflows/blui-ci.yml b/.github/workflows/blui-ci.yml new file mode 100644 index 00000000..e42936f3 --- /dev/null +++ b/.github/workflows/blui-ci.yml @@ -0,0 +1,119 @@ +name: CI Run + +on: + push: + branches: [ "dev", "master" ] + pull_request: + branches: [ "dev", "master" ] + pull_request_target: + types: + - opened + branches: + - '*/*' + +permissions: + pull-requests: write + contents: read + +jobs: + prettier_lint: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + cache-dependency-path: login-workflow + - run: yarn install:dependencies + working-directory: login-workflow + - run: yarn prettier + working-directory: login-workflow + - run: yarn lint + working-directory: login-workflow + + unit_test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + cache-dependency-path: login-workflow + - run: yarn --frozen-lockfile + working-directory: login-workflow + - run: yarn test:ci --coverage --watchAll=false + working-directory: login-workflow + - name: Upload to Codecov + uses: codecov/codecov-action@v3 + with: + directory: ./login-workflow/coverage/ + files: clover.xml + flags: unittests + name: codecov-report + verbose: true + + build_login_workflow: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + cache-dependency-path: login-workflow + - run: yarn --frozen-lockfile + working-directory: login-workflow + - run: yarn build + working-directory: login-workflow + - name: Save build + uses: actions/upload-artifact@v3 + with: + name: dist + if-no-files-found: error + path: login-workflow/dist + + publish_login_workflow: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') }} + needs: [prettier_lint, unit_test, build_login_workflow] + strategy: + matrix: + node-version: [18.x] + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + BRANCH: ${{ github.ref == 'refs/heads/master' && 'master' || 'dev' }} + steps: + - uses: actions/checkout@v4 + - name: Download dist + uses: actions/download-artifact@v3 + with: + name: dist + path: login-workflow/dist + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + registry-url: 'https://registry.npmjs.org' + cache-dependency-path: login-workflow + - run: yarn --frozen-lockfile + - run: yarn publish:package -b ${{env.BRANCH}} \ No newline at end of file