diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b4cf604..651e4ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,37 +6,30 @@ on: pull_request: branches: [ main, develop ] -env: - CI: true - NODE_VERSION: '18' - jobs: lint_and_test: name: Lint & Test runs-on: ubuntu-latest - + steps: - name: Checkout code uses: actions/checkout@v4 - - - name: Set up Node.js + + - name: Set up Node.js 20 uses: actions/setup-node@v3 with: - node-version: ${{ env.NODE_VERSION }} + node-version: 20 cache: 'npm' - - name: Install ESLintv8 + - name: Install ESLint run: npm install --save-dev eslint@8 - name: Run ESLint run: npx eslint src --ext .js,.jsx --max-warnings=0 - + - name: Run Jest tests run: npm run test:ci -# - name: Run Lighthouse CI -# run: npx lhci autorun --config=.lighthouserc.js - - name: Upload test coverage uses: actions/upload-artifact@v4 with: @@ -48,34 +41,31 @@ jobs: name: Build & Validate runs-on: ubuntu-latest needs: lint_and_test - strategy: - matrix: - node-version: [18.x] - + steps: - name: Checkout code uses: actions/checkout@v4 - - - name: Set up Node.js + + - name: Set up Node.js 20 uses: actions/setup-node@v3 with: - node-version: ${{ env.NODE_VERSION }} + node-version: 20 cache: 'npm' - + - name: Install dependencies - run: npm ci + run: npm install - name: Install serve run: npm install -g serve - + - name: Build project run: | - npm run build - ls -la build + npm run build + ls -la build - name: Set Public Url - run: echo "PUBLIC_URL=." >> $GITHUB_ENV - + run: echo "PUBLIC_URL=." >> $GITHUB_ENV + - name: Start Server and Log Output run: | npx serve -s build -l 8080 > server.log 2>&1 & @@ -86,7 +76,7 @@ jobs: - name: Display Server Logs run: cat server.log - - name: verify server running + - name: Verify server running run: | for i in {1..3}; do echo "Attempt $i to check server status..." @@ -99,34 +89,22 @@ jobs: fi done curl -I http://localhost:8080 || (echo "Server is not running after 3 attempts" && exit 1) - + - name: Check service worker run: | grep -i "serviceWorker" build/index.html || echo "❌ No service worker registered" ls build/service-worker.js || echo "❌ service-worker.js not found" - - name: List build content - run: ls -la build - - - name: Log server contents - run: cat server.log - - - name: Debug loaded HTML - run: curl -s http://localhost:8080 | tee page.html - - name: Debug Build Output run: | - echo "🔍 Build manifest.json:" - cat build/manifest.json || echo "❌ manifest.json missing" - - echo "🔍 Check index.html for manifest link:" - grep -i "manifest" build/index.html || echo "❌ Manifest not linked" - - echo "🔍 Apple touch icon:" - grep -i "apple-touch-icon" build/index.html || echo "❌ Not linked" - - echo "🔍 Check icons folder:" - ls -lh build/icons || echo "❌ Icons folder missing" + echo "🔍 manifest.json:" + cat build/manifest.json || echo "❌ missing" + echo "🔍 index.html link to manifest:" + grep -i "manifest" build/index.html || echo "❌ not linked" + echo "🔍 apple-touch-icon:" + grep -i "apple-touch-icon" build/index.html || echo "❌ not linked" + echo "🔍 icons folder:" + ls -lh build/icons || echo "❌ missing" # # - name: Run Lighthouse audit # uses: treosh/lighthouse-ci-action@v9 @@ -141,7 +119,7 @@ jobs: - name: Package Extension run: npm run package - + - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/.gitignore b/.gitignore index f774fad..f679ee2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +Ignore coverage .gitignore + #node modules take up alot of space after npm install #build related node_modules @@ -21,3 +23,7 @@ Icon #sensitive code .settings/ .vscode/ + +# Test coverage +coverage/ + diff --git a/.lighthouserc.json b/.lighthouserc.json index a41a382..81ab6c2 100644 --- a/.lighthouserc.json +++ b/.lighthouserc.json @@ -22,4 +22,5 @@ } } } + \ No newline at end of file diff --git a/coverage/coverage-final.json b/coverage/coverage-final.json index c18c109..efc2c3c 100644 --- a/coverage/coverage-final.json +++ b/coverage/coverage-final.json @@ -1,2 +1,2 @@ {"D:\\Cheaper\\cheaperFrontEnd\\cheaperFrontEnd\\src\\App.js": {"path":"D:\\Cheaper\\cheaperFrontEnd\\cheaperFrontEnd\\src\\App.js","statementMap":{"0":{"start":{"line":6,"column":44},"end":{"line":6,"column":56}},"1":{"start":{"line":7,"column":40},"end":{"line":7,"column":55}},"2":{"start":{"line":8,"column":40},"end":{"line":8,"column":55}},"3":{"start":{"line":9,"column":56},"end":{"line":9,"column":68}},"4":{"start":{"line":11,"column":23},"end":{"line":26,"column":3}},"5":{"start":{"line":12,"column":4},"end":{"line":12,"column":25}},"6":{"start":{"line":13,"column":4},"end":{"line":13,"column":25}},"7":{"start":{"line":16,"column":4},"end":{"line":25,"column":13}},"8":{"start":{"line":17,"column":26},"end":{"line":21,"column":7}},"9":{"start":{"line":23,"column":6},"end":{"line":23,"column":36}},"10":{"start":{"line":24,"column":6},"end":{"line":24,"column":28}},"11":{"start":{"line":28,"column":2},"end":{"line":78,"column":4}},"12":{"start":{"line":45,"column":14},"end":{"line":51,"column":20}},"13":{"start":{"line":60,"column":23},"end":{"line":60,"column":94}},"14":{"start":{"line":70,"column":27},"end":{"line":70,"column":53}}},"fnMap":{"0":{"name":"App","decl":{"start":{"line":5,"column":9},"end":{"line":5,"column":12}},"loc":{"start":{"line":5,"column":15},"end":{"line":79,"column":1}},"line":5},"1":{"name":"(anonymous_1)","decl":{"start":{"line":11,"column":23},"end":{"line":11,"column":24}},"loc":{"start":{"line":11,"column":39},"end":{"line":26,"column":3}},"line":11},"2":{"name":"(anonymous_2)","decl":{"start":{"line":16,"column":15},"end":{"line":16,"column":16}},"loc":{"start":{"line":16,"column":21},"end":{"line":25,"column":5}},"line":16},"3":{"name":"(anonymous_3)","decl":{"start":{"line":44,"column":30},"end":{"line":44,"column":31}},"loc":{"start":{"line":45,"column":14},"end":{"line":51,"column":20}},"line":45},"4":{"name":"(anonymous_4)","decl":{"start":{"line":60,"column":17},"end":{"line":60,"column":18}},"loc":{"start":{"line":60,"column":23},"end":{"line":60,"column":94}},"line":60},"5":{"name":"(anonymous_5)","decl":{"start":{"line":70,"column":21},"end":{"line":70,"column":22}},"loc":{"start":{"line":70,"column":27},"end":{"line":70,"column":53}},"line":70}},"branchMap":{"0":{"loc":{"start":{"line":35,"column":7},"end":{"line":37,"column":7}},"type":"binary-expr","locations":[{"start":{"line":35,"column":7},"end":{"line":35,"column":18}},{"start":{"line":36,"column":8},"end":{"line":36,"column":71}}],"line":35},"1":{"loc":{"start":{"line":39,"column":7},"end":{"line":57,"column":7}},"type":"binary-expr","locations":[{"start":{"line":39,"column":7},"end":{"line":39,"column":19}},{"start":{"line":39,"column":23},"end":{"line":39,"column":34}},{"start":{"line":40,"column":8},"end":{"line":56,"column":14}}],"line":39},"2":{"loc":{"start":{"line":43,"column":11},"end":{"line":55,"column":11}},"type":"cond-expr","locations":[{"start":{"line":44,"column":12},"end":{"line":52,"column":14}},{"start":{"line":54,"column":12},"end":{"line":54,"column":88}}],"line":43},"3":{"loc":{"start":{"line":66,"column":7},"end":{"line":76,"column":7}},"type":"binary-expr","locations":[{"start":{"line":66,"column":7},"end":{"line":66,"column":26}},{"start":{"line":67,"column":8},"end":{"line":75,"column":14}}],"line":66}},"s":{"0":9,"1":9,"2":9,"3":9,"4":9,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":9,"12":3,"13":1,"14":0},"f":{"0":9,"1":1,"2":1,"3":3,"4":1,"5":0},"b":{"0":[9,1],"1":[9,8,1],"2":[1,0],"3":[9,1]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"8167e691cfaee5596c0e870f7ca50a4c7651285f"} -} +} \ No newline at end of file diff --git a/coverage/lcov-report/App.js.html b/coverage/lcov-report/App.js.html index 7c41d3a..8b54005 100644 --- a/coverage/lcov-report/App.js.html +++ b/coverage/lcov-report/App.js.html @@ -1,4 +1,3 @@ - @@ -322,4 +321,5 @@