Skip to content

Commit

Permalink
Merge branch 'gsoc-24' into feature/like-dislike-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
lokeshwar777 authored Jul 8, 2024
2 parents 5c4bc6c + ef68cb1 commit 1f1ead9
Show file tree
Hide file tree
Showing 44 changed files with 30,344 additions and 392 deletions.
8 changes: 5 additions & 3 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

VITE_APP_FIREBASE_API_KEY=<FIREBASE_API_KEY>
VITE_APP_AUTH_DOMAIN=<FIREBASE_AUTH_DOMAIN>
VITE_APP_FIREBASE_AUTH_DOMAIN=<FIREBASE_AUTH_DOMAIN>
VITE_APP_FIREBASE_PROJECT_ID=<FIREBASE_PROJECT_ID>
VITE_APP_FIREBASE_MESSAGING_SENDER_ID=<FIREBASE_MESSAGING_SENDER_ID>
VITE_APP_FIREBASE_APP_ID=<FIREBASE_APP_ID>
VITE_APP_FIREBASE_MEASUREMENTID=<FIREBASE_MEASUREMENTID>
VITE_APP_DATABASE_URL=<FIREBASE_DATABASE_URL>
VITE_APP_FIREBASE_DATABASE_URL=<FIREBASE_DATABASE_URL>
VITE_APP_FIREBASE_STORAGE_BUCKET=<FIREBASE_STORAGE_BUCKET>
VITE_APP_FIREBASE_FCM_VAPID_KEY=<FIREBASE_VAPID_KEY>
VITE_APP_USE_EMULATOR=<USE_EMULATOR>
VITE_APP_FIREBASE_USE_EMULATOR=<USE_EMULATOR>
CYPRESS_PROJECT_ID=<CYPRESS_PROJECT_ID>
CYPRESS_RECORD_KEY=<CYPRESS_RECORD_KEY>
111 changes: 111 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Cypress End-to-End Tests

on: push

jobs:
cypress-tests:
name: Run Cypress Tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node: [18]

env:
CI: false

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node }}-
- name: Create .env File
run: |
echo "VITE_APP_FIREBASE_API_KEY=${{ secrets.VITE_APP_FIREBASE_API_KEY }}" >> .env
echo "VITE_APP_FIREBASE_PROJECT_ID=${{ secrets.VITE_APP_FIREBASE_PROJECT_ID }}" >> .env
echo "VITE_APP_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.VITE_APP_FIREBASE_MESSAGING_SENDER_ID }}" >> .env
echo "VITE_APP_FIREBASE_APP_ID=${{ secrets.VITE_APP_FIREBASE_APP_ID }}" >> .env
echo "VITE_APP_FIREBASE_MEASUREMENTID=${{ secrets.VITE_APP_FIREBASE_MEASUREMENTID }}" >> .env
echo "VITE_APP_FIREBASE_FCM_VAPID_KEY=${{ secrets.VITE_APP_FIREBASE_FCM_VAPID_KEY }}" >> .env
echo "VITE_APP_FIREBASE_AUTH_DOMAIN=${{ secrets.VITE_APP_FIREBASE_AUTH_DOMAIN }}" >> .env
echo "VITE_APP_FIREBASE_DATABASE_URL=${{ secrets.VITE_APP_FIREBASE_DATABASE_URL }}" >> .env
echo "VITE_APP_FIREBASE_USE_EMULATOR=true" >> .env
echo "SKIP_PREFLIGHT_CHECK=true" >> .env
echo "CI=false" >> .env
echo "CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }}" >> .env
- name: Prepare Firebase Service Account
run: |
mkdir -p functions/private
echo "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" > functions/private/cl-dev-pk.json
- name: Install Functions Dependencies
run: cd functions && npm install --legacy-peer-deps

- name: Install Firebase CLI
run: npm install -g firebase-tools

- name: Start Firebase Emulators
run: |
firebase emulators:start --import=./testdata --project ${{ secrets.VITE_APP_FIREBASE_PROJECT_ID }} &
sleep 15
- name: Run Cypress Tests
uses: cypress-io/github-action@v6
with:
browser: chrome
record: true
tag: node-${{ matrix.node }}
parallel: true
config-file: cypress.config.js
group: "GitHub Actions"
install-command: npm install --legacy-peer-deps
build: npm run build
start: npm run dev
wait-on: "http://localhost:5173"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
COMMIT_INFO_BRANCH: ${{ github.ref_name }}

print-results:
name: Print Cypress Cloud URL
needs: cypress-tests
runs-on: ubuntu-latest
if: always()
steps:
- name: Print Cypress Cloud URL
run: |
echo Cypress finished with: ${{ needs.cypress-tests.outcome }}
echo See results at ${{ needs.cypress-tests.outputs.resultsUrl }}
handle-failure:
name: Handle Failure
if: ${{ failure() }}
runs-on: ubuntu-latest
steps:
- name: Upload Cypress Artifacts
uses: actions/upload-artifact@v4
with:
name: Cypress Artifacts
path: |
cypress/screenshots
cypress/videos
if-no-files-found: ignore

- name: Notify on Failure
run: echo "The workflow has failed!"
43 changes: 43 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to Firebase Hosting on merge

on:
push:
branches:
- gsoc-24

jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Create .env file with secrets
run: |
echo "VITE_APP_FIREBASE_API_KEY=${{ secrets.VITE_APP_FIREBASE_API_KEY }}" >> .env
echo "VITE_APP_FIREBASE_PROJECT_ID=${{ secrets.VITE_APP_FIREBASE_PROJECT_ID }}" >> .env
echo "VITE_APP_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.VITE_APP_FIREBASE_MESSAGING_SENDER_ID }}" >> .env
echo "VITE_APP_FIREBASE_APP_ID=${{ secrets.VITE_APP_FIREBASE_APP_ID }}" >> .env
echo "VITE_APP_FIREBASE_MEASUREMENTID=${{ secrets.VITE_APP_FIREBASE_MEASUREMENTID }}" >> .env
echo "VITE_APP_FIREBASE_FCM_VAPID_KEY=${{ secrets.VITE_APP_FIREBASE_FCM_VAPID_KEY }}" >> .env
echo "VITE_APP_FIREBASE_AUTH_DOMAIN=${{ secrets.VITE_APP_FIREBASE_AUTH_DOMAIN }}" >> .env
echo "VITE_APP_FIREBASE_DATABASE_URL=${{ secrets.VITE_APP_FIREBASE_DATABASE_URL }}" >> .env
echo "VITE_APP_FIREBASE_USE_EMULATOR=false" >> .env
- name: Install Dependencies
run: |
npm install --legacy-peer-deps
npm run build || exit 1
- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CODELABZ_2CD64 }}
channelId: live
projectId: codelabz-2cd64
47 changes: 47 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy to Firebase Hosting on PR

on: pull_request

permissions:
checks: write
contents: read
pull-requests: write

jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Create .env file with secrets
run: |
echo "VITE_APP_FIREBASE_API_KEY=${{ secrets.VITE_APP_FIREBASE_API_KEY }}" >> .env
echo "VITE_APP_FIREBASE_PROJECT_ID=${{ secrets.VITE_APP_FIREBASE_PROJECT_ID }}" >> .env
echo "VITE_APP_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.VITE_APP_FIREBASE_MESSAGING_SENDER_ID }}" >> .env
echo "VITE_APP_FIREBASE_APP_ID=${{ secrets.VITE_APP_FIREBASE_APP_ID }}" >> .env
echo "VITE_APP_FIREBASE_MEASUREMENTID=${{ secrets.VITE_APP_FIREBASE_MEASUREMENTID }}" >> .env
echo "VITE_APP_FIREBASE_FCM_VAPID_KEY=${{ secrets.VITE_APP_FIREBASE_FCM_VAPID_KEY }}" >> .env
echo "VITE_APP_FIREBASE_AUTH_DOMAIN=${{ secrets.VITE_APP_FIREBASE_AUTH_DOMAIN }}" >> .env
echo "VITE_APP_FIREBASE_DATABASE_URL=${{ secrets.VITE_APP_FIREBASE_DATABASE_URL }}" >> .env
echo "VITE_APP_FIREBASE_USE_EMULATOR=false" >> .env
- name: Install Dependencies
run: |
npm install --legacy-peer-deps
npm run build || exit 1
- name: Deploy to Firebase Hosting Preview Channel
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_CODELABZ_2CD64 }}
projectId: codelabz-2cd64
channelId: pr-${{ github.event.pull_request.number }}
expires: 7d
60 changes: 0 additions & 60 deletions .github/workflows/main.yml

This file was deleted.

64 changes: 0 additions & 64 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/dist

#config
# src/config/index.js
Expand All @@ -28,7 +29,6 @@ yarn.lock
.env
/.idea
.vscode/settings.json
package-lock.json
INTERNAL.md
RULES.md
firebase-debug.log
Expand Down
4 changes: 3 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ export default defineConfig({
baseUrl: "http://localhost:5173",
testIsolation: false
},
projectId: process.env.CYPRESS_PROJECT_ID
projectId: process.env.CYPRESS_PROJECT_ID,
record: true, // Enable test recording
key: process.env.CYPRESS_RECORD_KEY // Cypress record key
});
4 changes: 2 additions & 2 deletions database.rules.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"rules": {
".read": false,
".write": false
".read": true,
".write": true
}
}
Loading

0 comments on commit 1f1ead9

Please sign in to comment.