From e9e73e746b9c7a897ae0d01dd6cd1975ef390da8 Mon Sep 17 00:00:00 2001 From: Kiko Ruiz Lloret Date: Mon, 18 Dec 2023 16:58:47 +0100 Subject: [PATCH] chore(Root): add type checking --- .github/workflows/main.yml | 60 +++++++++++++++++++++++++++++++++++ .github/workflows/node.js.yml | 40 ----------------------- package.json | 7 ++-- tsconfig.json | 11 +++---- 4 files changed, 69 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..f680facc9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,60 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Redundant Builds + uses: styfle/cancel-workflow-action@0.6.0 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@v4 + with: + registry-url: 'https://registry.npmjs.org' + node-version-file: '.nvmrc' + cache: 'npm' + cache-dependency-path: 'package-lock.json' + + - name: Setup Chrome + uses: browser-actions/setup-chrome@latest + + - name: Install + run: | + sudo apt-get install xvfb + npm install --no-save --no-fund --no-audit --legacy-peer-deps + npx -y ultra-runner --raw --recursive prepublishOnly + + - name: Lint + run: npm run lint + + - name: Type Checking + run: npm run types:check + + - name: Tests + run: | + npm run test:server:ci + xvfb-run --auto-servernum npm run test:client:ci + + - name: Release packages + run: npx -p ./packages/sui-ci sui-ci release + env: + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + GITHUB_EMAIL: cloud-accounts@scmspain.com + GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }} + GITHUB_USER: sui-bot + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 2aa091457..000000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: CI - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Redundant Builds - uses: styfle/cancel-workflow-action@0.6.0 - with: - access_token: ${{ github.token }} - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - persist-credentials: false - - uses: actions/setup-node@v2 - with: - node-version: 18 - registry-url: 'https://registry.npmjs.org' - - uses: browser-actions/setup-chrome@latest - - run: sudo apt-get install xvfb - - run: npm install --no-save --no-fund --no-audit --legacy-peer-deps - - run: npx -y ultra-runner --raw --recursive prepublishOnly - - run: npm run lint - - run: npm run test:server:ci - - run: xvfb-run --auto-servernum npm run test:client:ci - - run: npx -p ./packages/sui-ci sui-ci release - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - GITHUB_EMAIL: cloud-accounts@scmspain.com - GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }} - GITHUB_USER: sui-bot - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 1dd8da3a0..02b9a1b71 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,9 @@ "test:server:watch": "npm run test:server -- --watch", "test:e2e": "node ./packages/sui-studio/test/server/integration/static-server.js ./packages/sui-studio/test/server/integration/sample-studio/public && npx @s-ui/test-e2e --baseUrl=http://localhost:1234", "pre-commit": "sui-lint js --staged && sui-lint sass --staged", - "pre-push": "npm run test", - "commit-msg": "validate-commit-msg" + "pre-push": "npm run test && npm run types:check", + "commit-msg": "validate-commit-msg", + "types:check": "tsc" }, "devDependencies": { "@babel/cli": "7", @@ -79,4 +80,4 @@ "stylelint": { "extends": "./node_modules/@s-ui/lint/stylelint.config.js" } -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index d90b1d3a1..96482e01e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,11 +11,10 @@ "skipLibCheck": true, "strict": true, "target": "es5", - "types": [ - "react", - "node" - ] + "types": ["react", "node"] }, "exclude": ["node_modules", "lib"], - "typeAcquisition": { "enable": true } -} \ No newline at end of file + "typeAcquisition": { + "enable": true + } +}