From fc5f41c79d7e62313b7e1b1cd31b262099e37b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Duarte?= Date: Thu, 7 Mar 2024 17:58:23 +0000 Subject: [PATCH] Make CI run storybook locally --- .dockerignore | 3 +- .github/workflows/ci.yml | 11 +----- .gitignore | 1 + package-lock.json | 74 ++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index 1dac554e..75c092f4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,4 +10,5 @@ node_modules/ docker-compose.yml Dockerfile* *.md -*.sh \ No newline at end of file +*.sh +storybook-static/ \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db262078..d63f14f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,17 +76,8 @@ jobs: - name: Install Playwright run: npx playwright install - - name: Wait for the Netlify Preview - uses: kamranayub/wait-for-netlify-action@v2.1.0 - id: waitForNetlify - with: - site_name: 'niaefeup-frontend-storybook' - max_timeout: 300 # 5 minutes - env: - NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }} - - name: Test - run: npm run test-storybook:coverage -- --url ${{ steps.waitForNetlify.outputs.url }} --ci + run: npm run test-storybook:ci - name: Upload code coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/.gitignore b/.gitignore index de4cb77d..a3251b22 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ vite.config.ts.timestamp-* # Test Reports /coverage +storybook-static/ diff --git a/package-lock.json b/package-lock.json index 53232eac..7ea5fb1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "@typescript-eslint/parser": "^7.1.0", "autoprefixer": "^10.4.17", "axe-playwright": "^2.0.1", + "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-typescript": "^3.6.1", @@ -8862,6 +8863,48 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/concurrently": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", + "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "date-fns": "^2.30.0", + "lodash": "^4.17.21", + "rxjs": "^7.8.1", + "shell-quote": "^1.8.1", + "spawn-command": "0.0.2", + "supports-color": "^8.1.1", + "tree-kill": "^1.2.2", + "yargs": "^17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": "^14.13.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/consola": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", @@ -9024,6 +9067,22 @@ "node": ">=0.8" } }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/date-format": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.3.tgz", @@ -17618,6 +17677,15 @@ "node": ">=8" } }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/side-channel": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.5.tgz", @@ -17731,6 +17799,12 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/spawn-command": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", + "dev": true + }, "node_modules/spawn-wrap": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", diff --git a/package.json b/package.json index ee431497..37f4df3a 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "test-vite:watch": "vitest --watch", "test-storybook": "test-storybook --browsers firefox", "test-storybook:coverage": "npm run test-storybook -- --coverage", + "test-storybook:ci": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npm run build-storybook --quiet && npx http-server storybook-static --port 6006 --silent\" \"wait-on tcp:6006 && npm run test-storybook:coverage\"", "lint": "prettier --check . && eslint .", "format": "prettier --write .", "storybook": "storybook dev -p 6006", @@ -41,6 +42,7 @@ "@typescript-eslint/parser": "^7.1.0", "autoprefixer": "^10.4.17", "axe-playwright": "^2.0.1", + "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-typescript": "^3.6.1",