From bbab179aba129dba8408877dd8c6c720ba985403 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Wed, 24 Apr 2024 12:01:11 -0400 Subject: [PATCH 1/5] add blui-ci github workflow --- .circleci/config.yml | 146 ---------------------------------- .github/workflows/blui-ci.yml | 120 ++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 146 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/blui-ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c418080f7..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,146 +0,0 @@ -version: 2.1 -orbs: - codecov: codecov/codecov@3.3.0 - gh: circleci/github-cli@2.2.0 -jobs: - prettier_lint: - working_directory: ~/login-workflow - docker: - - image: cimg/node:18.19.0-browsers - 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" }} - - run: - name: Prettier Check - command: | - cd login-workflow - yarn prettier:check - - run: - name: Lint - command: | - cd login-workflow - yarn lint - store_test_results: - docker: - - image: cimg/node:18.19.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 - - save_cache: - name: Save Cache - paths: - - node_modules - key: v2-dependencies-{{ checksum "login-workflow/yarn.lock" }} - - run: - name: Tests - command: | - cd login-workflow - yarn test --maxWorkers=2 --coverage --watchAll=false - - persist_to_workspace: - root: . - paths: - - login-workflow/coverage - build_login_workflow: - working_directory: ~/login-workflow - docker: - - image: cimg/node:18.19.0-browsers - 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" }} - - run: - name: Build - command: | - cd login-workflow - yarn build - - persist_to_workspace: - root: . - paths: - - login-workflow/lib - coverage_report: - working_directory: ~/login-workflow - docker: - - image: cimg/node:18.19.0-browsers - steps: - - checkout - - attach_workspace: - at: . - - codecov/upload: - file: './login-workflow/coverage/clover.xml' - token: CODECOV_TOKEN - - publish_login_workflow: - docker: - - image: cimg/node:18.19.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-native-auth-workflow - command: | - cd login-workflow && yarn publish:package -b $CIRCLE_BRANCH - -workflows: - version: 2 - react_native_workflows: - jobs: - - prettier_lint - - 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 000000000..fadeb783d --- /dev/null +++ b/.github/workflows/blui-ci.yml @@ -0,0 +1,120 @@ +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 --frozen-lockfile + 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 --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: lib + if-no-files-found: error + path: login-workflow/lib + + 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 lib + uses: actions/download-artifact@v3 + with: + name: lib + path: login-workflow/lib + - 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: npm run publish:package -b ${{env.BRANCH}} + working-directory: login-workflow \ No newline at end of file From 3110c7e4bae92eb584ae531e44369324d8147cfd Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Wed, 24 Apr 2024 12:06:09 -0400 Subject: [PATCH 2/5] trigger ci run --- login-workflow/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/login-workflow/README.md b/login-workflow/README.md index c8e90c710..55b6d8045 100644 --- a/login-workflow/README.md +++ b/login-workflow/README.md @@ -1,4 +1,5 @@ # React Native Auth Workflow +# trigger ci [![](https://img.shields.io/circleci/project/github/etn-ccis/blui-react-native-workflows/master.svg?style=flat)](https://circleci.com/gh/etn-ccis/blui-react-native-workflows/tree/master) ![npm (scoped)](https://img.shields.io/npm/v/@brightlayer-ui/react-native-auth-workflow) [![codecov](https://codecov.io/gh/etn-ccis/blui-react-native-workflows/branch/master/graph/badge.svg?token=U4OI0D5UVP)](https://codecov.io/gh/etn-ccis/blui-react-native-workflows) From 7bfd747bdf3d1e88177fc578471e74c8cda443c3 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Wed, 24 Apr 2024 12:07:47 -0400 Subject: [PATCH 3/5] trigger again on branch --- .github/workflows/blui-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blui-ci.yml b/.github/workflows/blui-ci.yml index fadeb783d..1c5fd8ff7 100644 --- a/.github/workflows/blui-ci.yml +++ b/.github/workflows/blui-ci.yml @@ -2,9 +2,9 @@ name: CI Run on: push: - branches: [ "dev", "master" ] + branches: [ "release/R31", "dev", "master" ] pull_request: - branches: [ "dev", "master" ] + branches: [ "release/R31", "dev", "master" ] pull_request_target: types: - opened From 0835423bc170b3550a76c36e79415f484bd93cc5 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Wed, 24 Apr 2024 12:23:54 -0400 Subject: [PATCH 4/5] revert readme --- login-workflow/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/login-workflow/README.md b/login-workflow/README.md index 55b6d8045..c8e90c710 100644 --- a/login-workflow/README.md +++ b/login-workflow/README.md @@ -1,5 +1,4 @@ # React Native Auth Workflow -# trigger ci [![](https://img.shields.io/circleci/project/github/etn-ccis/blui-react-native-workflows/master.svg?style=flat)](https://circleci.com/gh/etn-ccis/blui-react-native-workflows/tree/master) ![npm (scoped)](https://img.shields.io/npm/v/@brightlayer-ui/react-native-auth-workflow) [![codecov](https://codecov.io/gh/etn-ccis/blui-react-native-workflows/branch/master/graph/badge.svg?token=U4OI0D5UVP)](https://codecov.io/gh/etn-ccis/blui-react-native-workflows) From 6f82d798c442776cc8d3e8647be60e202a8696d4 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Wed, 24 Apr 2024 12:40:07 -0400 Subject: [PATCH 5/5] update branch remove release/R31 from test --- .github/workflows/blui-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/blui-ci.yml b/.github/workflows/blui-ci.yml index 1c5fd8ff7..fadeb783d 100644 --- a/.github/workflows/blui-ci.yml +++ b/.github/workflows/blui-ci.yml @@ -2,9 +2,9 @@ name: CI Run on: push: - branches: [ "release/R31", "dev", "master" ] + branches: [ "dev", "master" ] pull_request: - branches: [ "release/R31", "dev", "master" ] + branches: [ "dev", "master" ] pull_request_target: types: - opened