Skip to content

Commit

Permalink
set up github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jessica2673 committed Feb 4, 2024
1 parent 17156fa commit 8098ee7
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
db-init/create-multiple-dbs.sh eol=lf
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Notion ticket link
<!-- Please replace with your ticket's URL -->
[Ticket Name](https://www.notion.so/uwblueprintexecs/Task-Board-86718c51ea274d06803384b2f8f5d201?p=b3af65cb12b44158895dfc77ff938436&pm=s)


<!-- Give a quick summary of the implementation details, provide design justifications if necessary -->
## Implementation description
*


<!-- What should the reviewer do to verify your changes? Describe expected results and include screenshots when appropriate -->
## Steps to test
1.


<!-- Draw attention to the substantial parts of your PR or anything you'd like a second opinion on -->
## What should reviewers focus on?
*


## Checklist
- [ ] My PR name is descriptive and in imperative tense
- [ ] My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
- [ ] I have run the appropriate linter(s)
- [ ] I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR
33 changes: 33 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy frontend to Firebase Hosting

on:
push:
branches:
- main
paths:
- "frontend/**"

defaults:
run:
working-directory: frontend

jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo "REACT_APP_BACKEND_URL=${{ secrets.DEV_BACKEND_URL }}" > .env
auth {
- run: echo "REACT_APP_OAUTH_CLIENT_ID=${{ secrets.DEV_OAUTH_CLIENT_ID }}" >> .env
} auth
- run: rm -rf node_modules && yarn install --frozen-lockfile && yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_UW_BLUEPRINT_STARTER_CODE }}"
channelId: live
projectId: "${{ secrets.DEV_PROJECT_ID }}"
entryPoint: ./frontend
31 changes: 31 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy frontend to Firebase Hosting preview

on:
pull_request:
paths:
- "frontend/**"

defaults:
run:
working-directory: frontend

jobs:
build_and_preview:
if: "${{ github.event.pull_request.head.repo.full_name == github.repository && github.base_ref == 'dev' }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo "REACT_APP_BACKEND_URL=${{ secrets.PREVIEW_BACKEND_URL }}" > .env
auth {
- run: echo "REACT_APP_OAUTH_CLIENT_ID=${{ secrets.DEV_OAUTH_CLIENT_ID }}" >> .env
} auth
- run: rm -rf node_modules && yarn install --frozen-lockfile && yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_UW_BLUEPRINT_STARTER_CODE }}"
projectId: "${{ secrets.DEV_PROJECT_ID }}"
entryPoint: ./frontend
60 changes: 60 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Lint codebase

on:
push:
branches:
- dev
paths:
- "frontend/**"
- "backend/typescript/**"
pull_request:
branches:
- dev
paths:
- "frontend/**"
- "backend/typescript/**"

jobs:
run-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Filter changed files
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
frontend:
- "frontend/**"
typescript-backend:
- "backend/typescript/**"
- name: Set up Node.js
if: steps.changes.outputs.frontend == 'true' || steps.changes.outputs.typescript-backend == 'true'
uses: actions/setup-node@v2
with:
node-version: "18.18.2"
cache: "yarn"
cache-dependency-path: |
frontend/yarn.lock
backend/typescript/yarn.lock
- name: Install Node.js dependencies
if: steps.changes.outputs.frontend == 'true' || steps.changes.outputs.typescript-backend == 'true'
run: yarn --cwd ./frontend --prefer-offline && yarn --cwd ./backend/typescript --prefer-offline

- name: Generate Prisma Data Models
working-directory: ./
run: npx prisma generate && yarn tsc

- name: Lint frontend
if: steps.changes.outputs.frontend == 'true'
working-directory: ./frontend
run: yarn lint

- name: Lint TypeScript backend
if: steps.changes.outputs.typescript-backend == 'true'
working-directory: ./backend/typescript
run: yarn lint
4 changes: 4 additions & 0 deletions backend/typescript/prisma/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();
export default prisma;
10 changes: 10 additions & 0 deletions backend/typescript/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}


1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
condition: service_healthy
env_file:
- ./.env
- ./backend/typescript/.env
db:
# TODO: rename container for your project
container_name: scv2_db
Expand Down

0 comments on commit 8098ee7

Please sign in to comment.