From b012de6a904713bf0fc26f41703fac62dfe210d8 Mon Sep 17 00:00:00 2001 From: Gearonix Date: Fri, 6 Oct 2023 16:18:00 +0300 Subject: [PATCH] ci: fixes --- .eslintrc.js | 13 +-- .github/workflows/build.yml | 46 ++------ .github/workflows/deploy.yml | 109 ------------------ .github/workflows/lint.yml | 54 --------- .../workflows/{tests.yml => storybook.yml} | 25 ++-- nx.json | 4 +- 6 files changed, 26 insertions(+), 225 deletions(-) delete mode 100644 .github/workflows/deploy.yml delete mode 100644 .github/workflows/lint.yml rename .github/workflows/{tests.yml => storybook.yml} (70%) diff --git a/.eslintrc.js b/.eslintrc.js index 894141f4..ba99f3b9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,17 +3,8 @@ const grnx = require('@grnx-utils/eslint') module.exports = grnx({ root: __dirname, tsconfig: 'tsconfig.base.json', - // monorepo: true, - ignore: [ - 'dist', - 'node_modules', - '.idea', - '.yarn', - 'build', - 'tmp', - 'coverage' - ], ext: { - 'import/export': 'off' + 'import/export': 'off', + 'max-len': 'off' } }) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 914e9233..ccd3c5fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,42 +53,12 @@ jobs: - name: Creating a Production Build run: yarn dlx nx run root:build - build-storybook: - name: Building and deploying storybook - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v3 - with: - main-branch-name: 'master' - - - run: | - echo "BASE: ${{ env.NX_BASE }}" - echo "HEAD: ${{ env.NX_HEAD }}" - - - name: Installing Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.8.0 - - - name: Cache Yarn dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cache/yarn - ~/.yarn/cache - .yarn/cache - node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/*.yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Installing dependencies - run: yarn install - - name: Building storybook - run: yarn dlx nx run web-ui:storybook:build + - name: Pushing to build branch + uses: s0/git-publish-subdir-action@develop + env: + REPO: self + BRANCH: build + FOLDER: dist + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MESSAGE: "Build: ({sha}) {msg}" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index fc24739f..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,109 +0,0 @@ -name: code-gear > deploy -on: - pull_request: - branches: - - master - - ci-testing - push: - branches: - - master - - ci-testing - workflow_call: - -permissions: - contents: write - -jobs: - build: - uses: ./.github/workflows/build.yml - push-build: - needs: [build] - name: Pushing workflow to build branch - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v3 - with: - main-branch-name: 'master' - - - run: | - echo "BASE: ${{ env.NX_BASE }}" - echo "HEAD: ${{ env.NX_HEAD }}" - - - name: Installing Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.8.0 - - - name: Cache Yarn dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cache/yarn - ~/.yarn/cache - .yarn/cache - node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/*.yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Installing dependencies - run: yarn install - - - name: Pushing to build branch - uses: s0/git-publish-subdir-action@develop - env: - REPO: self - BRANCH: build - FOLDER: dist - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MESSAGE: "Build: ({sha}) {msg}" - - push-storybook: - needs: [build] - name: Building and deploying storybook - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v3 - with: - main-branch-name: 'master' - - - run: | - echo "BASE: ${{ env.NX_BASE }}" - echo "HEAD: ${{ env.NX_HEAD }}" - - - name: Installing Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.8.0 - - - name: Cache Yarn dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cache/yarn - ~/.yarn/cache - .yarn/cache - node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/*.yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Installing dependencies - run: yarn install - - - name: Pushing to build-storybook branch - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: dist/storybook/ui - branch: storybook-build - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 47bc1092..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: code-gear > lint -on: - pull_request: - branches: - - master - - ci-testing - push: - branches: - - master - - ci-testing -permissions: - contents: write - -jobs: - lint: - name: Linting project - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Derive appropriate SHAs for base and head for `nx affected` commands - uses: nrwl/nx-set-shas@v3 - with: - main-branch-name: 'master' - - - run: | - echo "BASE: ${{ env.NX_BASE }}" - echo "HEAD: ${{ env.NX_HEAD }}" - - - name: Installing Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.8.0 - - - name: Cache Yarn dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cache/yarn - ~/.yarn/cache - .yarn/cache - node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/*.yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Installing dependencies - run: yarn install - - - - name: Linting project - run: yarn dlx nx run root:lint diff --git a/.github/workflows/tests.yml b/.github/workflows/storybook.yml similarity index 70% rename from .github/workflows/tests.yml rename to .github/workflows/storybook.yml index 8c93d30a..799d5901 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/storybook.yml @@ -1,4 +1,4 @@ -name: code-gear > tests +name: code-gear > storybook on: pull_request: branches: @@ -8,16 +8,14 @@ on: branches: - master - ci-testing + workflow_call: + permissions: contents: write jobs: build-storybook: - uses: ./.github/workflows/build.yml - test-storybook: - - name: testing storybook - needs: [build-storybook] + name: Building, testing and deploying storybook runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -53,10 +51,15 @@ jobs: - name: Installing dependencies run: yarn install + - name: Building storybook + run: yarn dlx nx run web-ui:storybook:build + + - name: Pushing to build-storybook branch + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: dist/storybook/ui + branch: storybook-build + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Testing storybook in production - run: yarn dlx nx run ui:storybook:test:production -# test: -# name: testing project -# runs-on: ubuntu-latest -# steps: + run: yarn dlx nx run web-ui:storybook:test:production diff --git a/nx.json b/nx.json index cc9fc511..8e9d1bd6 100644 --- a/nx.json +++ b/nx.json @@ -14,7 +14,7 @@ "lint", "test", "e2e", - "build-storybook" + "storybook:build" ], "accessToken": "MDYwYjBjOTMtZjZhMi00YmVkLTg2MmMtZjgwNmI0OGFiNmRkfHJlYWQtd3JpdGU=" } @@ -50,7 +50,7 @@ "{workspaceRoot}/.eslintignore" ] }, - "build-storybook": { + "storybook:build": { "inputs": [ "default", "^production",