From 57c34deeae6db4d1c13cfabd1c2e3903a8871c66 Mon Sep 17 00:00:00 2001 From: demuelle Date: Tue, 8 Apr 2025 09:45:57 -0500 Subject: [PATCH 1/5] removes todo --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 86e87472..b36556c1 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ GitHub Actions is a great solution to this problem. For example, you could creat ## Initial Project Setup -TODO: this definitely doesn't work To begin, start by forking the following repository [GitHub Actions Demo](https://github.com/coding-boot-camp/github-actions-demo). Once you have forked this repository you should then clone the forked repository to your local machine. ## Create the Workflow From d6115d6a819f95a1d41e649de946f3d23d9fbbcc Mon Sep 17 00:00:00 2001 From: Shawna Chirillo Date: Tue, 8 Apr 2025 18:34:42 -0500 Subject: [PATCH 2/5] updates --- .github/workflows/main.yml | 24 ++++++++++ package-lock.json | 94 +++++++++++++++++++------------------- package.json | 7 +-- 3 files changed, 74 insertions(+), 51 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..8e4f2d30 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,24 @@ +version: 2.1 +orbs: + cypress: cypress-io/cypress@3.3.1 + +jobs: + start-server: + docker: + - image: cypress/base:latest + steps: + - checkout + - run: + name: Install dependencies + command: npm install + - run: + name: Build the app + command: npm run build + +workflows: + run-tests: + jobs: + - start-server + - cypress/run: + name: run-component-tests + cypress-command: npx cypress run --component diff --git a/package-lock.json b/package-lock.json index f5a5a747..da0ccd86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "vite-project", "version": "0.0.0", "dependencies": { + "lint": "^1.1.2", "react": "^18.2.0", "react-dom": "^18.2.0" }, @@ -23,7 +24,7 @@ "eslint": "^8.45.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", - "happy-dom": "^14.12.3", + "happy-dom": "^17.4.4", "pretty": "^2.0.0", "typescript": "^5.0.2", "vite": "^4.4.5", @@ -227,27 +228,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz", - "integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", + "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.26.9", - "@babel/types": "^7.26.9" + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz", - "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.26.9" + "@babel/types": "^7.27.0" }, "bin": { "parser": "bin/babel-parser.js" @@ -289,9 +290,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz", - "integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz", + "integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==", "dev": true, "license": "MIT", "dependencies": { @@ -302,15 +303,15 @@ } }, "node_modules/@babel/template": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", - "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.26.2", - "@babel/parser": "^7.26.9", - "@babel/types": "^7.26.9" + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" }, "engines": { "node": ">=6.9.0" @@ -336,9 +337,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", - "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", "dev": true, "license": "MIT", "dependencies": { @@ -2470,19 +2471,6 @@ "dev": true, "license": "MIT" }, - "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/es-module-lexer": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", @@ -3086,18 +3074,17 @@ "license": "MIT" }, "node_modules/happy-dom": { - "version": "14.12.3", - "resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-14.12.3.tgz", - "integrity": "sha512-vsYlEs3E9gLwA1Hp+w3qzu+RUDFf4VTT8cyKqVICoZ2k7WM++Qyd2LwzyTi5bqMJFiIC/vNpTDYuxdreENRK/g==", + "version": "17.4.4", + "resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-17.4.4.tgz", + "integrity": "sha512-/Pb0ctk3HTZ5xEL3BZ0hK1AqDSAUuRQitOmROPHhfUYEWpmTImwfD8vFDGADmMAX0JYgbcgxWoLFKtsWhcpuVA==", "dev": true, "license": "MIT", "dependencies": { - "entities": "^4.5.0", "webidl-conversions": "^7.0.0", "whatwg-mimetype": "^3.0.0" }, "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" } }, "node_modules/has-flag": { @@ -3597,6 +3584,17 @@ "node": ">= 0.8.0" } }, + "node_modules/lint": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/lint/-/lint-1.1.2.tgz", + "integrity": "sha512-kOzKdN0iSdkx57102MxZd64yn32rHaB6xqBMN3hyCRiBV2xiurM75XWvTHWNK/SJBCddHPhjDLV+kNr3Uf1MGg==", + "bin": { + "node-lint": "bin/node-lint" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -4665,9 +4663,9 @@ } }, "node_modules/vite": { - "version": "4.5.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.9.tgz", - "integrity": "sha512-qK9W4xjgD3gXbC0NmdNFFnVFLMWSNiR3swj957yutwzzN16xF/E7nmtAyp1rT9hviDroQANjE4HK3H4WqWdFtw==", + "version": "4.5.12", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.12.tgz", + "integrity": "sha512-qrMwavANtSz91nDy3zEiUHMtL09x0mniQsSMvDkNxuCBM1W5vriJ22hEmwTth6DhLSWsZnHBT0yHFAQXt6efGA==", "dev": true, "license": "MIT", "dependencies": { @@ -5196,9 +5194,9 @@ } }, "node_modules/vite-node/node_modules/vite": { - "version": "5.4.14", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", - "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", + "version": "5.4.17", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.17.tgz", + "integrity": "sha512-5+VqZryDj4wgCs55o9Lp+p8GE78TLVg0lasCH5xFZ4jacZjtqZa6JUw9/p0WeAojaOfncSM6v77InkFPGnvPvg==", "dev": true, "license": "MIT", "dependencies": { @@ -5801,9 +5799,9 @@ } }, "node_modules/vitest/node_modules/vite": { - "version": "5.4.14", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", - "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", + "version": "5.4.17", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.17.tgz", + "integrity": "sha512-5+VqZryDj4wgCs55o9Lp+p8GE78TLVg0lasCH5xFZ4jacZjtqZa6JUw9/p0WeAojaOfncSM6v77InkFPGnvPvg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e0adbbe8..ecef0432 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,12 @@ "dev": "vite --port 3000", "build": "tsc && vite build", "lint": "eslint src --ext js,tsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview", - "eslint": "eslint src", + "preview": "vite preview", + "eslint": "eslint src", "test": "vitest" }, "dependencies": { + "lint": "^1.1.2", "react": "^18.2.0", "react-dom": "^18.2.0" }, @@ -27,7 +28,7 @@ "eslint": "^8.45.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", - "happy-dom": "^14.12.3", + "happy-dom": "^17.4.4", "pretty": "^2.0.0", "typescript": "^5.0.2", "vite": "^4.4.5", From 168a5104d59a17b5d8f06894b337ee4bd8e05142 Mon Sep 17 00:00:00 2001 From: Shawna Chirillo Date: Tue, 8 Apr 2025 18:38:10 -0500 Subject: [PATCH 3/5] fixed yml --- .github/workflows/main.yml | 43 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e4f2d30..9f5373be 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,24 +1,29 @@ -version: 2.1 -orbs: - cypress: cypress-io/cypress@3.3.1 +name: CI Workflow + +on: + push: + branches: + - main + pull_request: jobs: start-server: - docker: - - image: cypress/base:latest - steps: - - checkout - - run: - name: Install dependencies - command: npm install - - run: - name: Build the app - command: npm run build + runs-on: ubuntu-latest + container: + image: cypress/base:latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Install dependencies + run: npm install + - name: Build the app + run: npm run build -workflows: run-tests: - jobs: - - start-server - - cypress/run: - name: run-component-tests - cypress-command: npx cypress run --component + needs: start-server + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Run Cypress component tests + run: npx cypress run --component From 1085dfbfa262aafe142fa0c1b79ffb6b65b21142 Mon Sep 17 00:00:00 2001 From: Shawna Chirillo Date: Tue, 8 Apr 2025 18:54:28 -0500 Subject: [PATCH 4/5] yml update --- .github/workflows/main.yml | 45 +++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9f5373be..d12a5f6a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,29 +1,34 @@ -name: CI Workflow +# Name of workflow +name: Lint workflow +# Trigger workflow on all pull requests on: - push: - branches: - - main pull_request: + branches: + - develop + - staging +# Jobs to carry out jobs: - start-server: + test: + # Operating system to run job on runs-on: ubuntu-latest - container: - image: cypress/base:latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Install dependencies - run: npm install - - name: Build the app - run: npm run build - run-tests: - needs: start-server - runs-on: ubuntu-latest + # Steps in job steps: + # Get code from repo - name: Checkout code - uses: actions/checkout@v3 - - name: Run Cypress component tests - run: npx cypress run --component + uses: actions/checkout@v1 + + - name: Use Node.js 21.x + uses: actions/setup-node@v1 + with: + node-version: 21.x + + # Install dependencies + - name: 🧰 Install Deps + run: npm install + + # Run lint + - name: Run Lint + run: npm run lint From 9a5949d15ae9af81edde55f548df5a0a6e08985e Mon Sep 17 00:00:00 2001 From: Shawna Chirillo Date: Tue, 8 Apr 2025 18:58:04 -0500 Subject: [PATCH 5/5] fixed test --- src/components/Calculator.tsx | 1 + src/tests/__snapshots__/Calculator.test.tsx.snap | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Calculator.tsx b/src/components/Calculator.tsx index bfac7800..9040d335 100644 --- a/src/components/Calculator.tsx +++ b/src/components/Calculator.tsx @@ -15,6 +15,7 @@ export default function Calculator() { return (
+

Simple Calculator

should match snapshot 1`] = ` "

Simple Calculator

-

+

Total: 0

Previous Total: 0

" `;