Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: deplyment
on:
push:
branches: [main]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

steps:
- name: check out code
uses: actions/checkout@v4

- name: set up Node environment
uses: actions/setup-node@v4
with:
node-version: 22
- name: install dependencies
run: npm ci

- name: build project
run: npm run build

- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v3'

- name: 'Use gcloud CLI'
run: 'gcloud info'

- name: "build and push docker image to GCR"
run: gcloud builds submit --tag us-central1-docker.pkg.dev/majestic-lodge-489822-u6/notely-ar-repo/notely:latest .
- name: "run migrations"
run: npm run db:migrate
- name: "Deploy to Cloud Run"
run: gcloud run deploy notely --image us-central1-docker.pkg.dev/majestic-lodge-489822-u6/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project majestic-lodge-489822-u6 --max-instances=4
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: ci

on:
pull_request:
branches: [main]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test -- --coverage
style:
name: Style
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: npm ci

- name: Check formatting
run: npm run format:check

- name: checks for formatting issues
run: npm run lint -- --max-warnings=0
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ npm run dev
_This starts the server in non-database mode._ It will serve a simple webpage at `http://localhost:8080`.

You do _not_ need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course!
mahmoud's version of Boot.dev's Notely app.
Here is coverage:
![Coverage: ](https://github.com/bashamahmoud/learn-cicd-typescript-starter/actions/workflows/ci.yml/badge.svg)
19 changes: 19 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import { defineConfig } from "eslint/config";
import pluginSecurity from "eslint-plugin-security";

export default defineConfig([
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
plugins: { js },
extends: ["js/recommended"],
},
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
languageOptions: { globals: globals.node },
},
tseslint.configs.recommended,
pluginSecurity.configs.recommended,
]);
Loading