From eca12a70feb2afbf8ef99ae5806fcbf08b588d54 Mon Sep 17 00:00:00 2001 From: michael seaman Date: Thu, 13 Mar 2025 18:59:49 -0700 Subject: [PATCH 1/4] made a comment --- .github/workflows/main.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) 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..620b6bf8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +# Name of workflow +name: Lint workflow + +# Trigger workflow on all pull requests +on: + pull_request: + branches: + - develop + - staging + +# Jobs to carry out +#comment +jobs: + test: + # Operating system to run job on + runs-on: ubuntu-latest + + # Steps in job + steps: + # Get code from repo + - name: Checkout code + 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 24ac62b92ee6d1fa0bf276836023f4fcb346e811 Mon Sep 17 00:00:00 2001 From: michael seaman Date: Thu, 13 Mar 2025 19:17:50 -0700 Subject: [PATCH 2/4] updated yml --- .github/workflows/main.yml | 11 +++++++++-- package.json | 4 ++-- src/components/Advertisement.tsx | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 620b6bf8..ddaa3743 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ # Name of workflow -name: Lint workflow +name: Lint and Test workflow # Trigger workflow on all pull requests on: @@ -9,7 +9,6 @@ on: - staging # Jobs to carry out -#comment jobs: test: # Operating system to run job on @@ -33,3 +32,11 @@ jobs: # Run lint - name: Run Lint run: npm run lint + + # Run build + - name: Run Build + run: npm run build + + # Run tests + - name: Run Tests + run: npm run test \ No newline at end of file diff --git a/package.json b/package.json index e0adbbe8..bd804ebd 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "build": "tsc && vite build", "lint": "eslint src --ext js,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", - "eslint": "eslint src", - "test": "vitest" + "eslint": "eslint src", + "test": "vitest" }, "dependencies": { "react": "^18.2.0", diff --git a/src/components/Advertisement.tsx b/src/components/Advertisement.tsx index 2181f6aa..bb55bcb2 100644 --- a/src/components/Advertisement.tsx +++ b/src/components/Advertisement.tsx @@ -2,7 +2,7 @@ interface AdvertisementProps { companyName: string; productDescription: string; price: string; -}; +} function Advertisement(props: AdvertisementProps) { return ( From 917f1f364c1f6b6984195469396a447c674ec1d4 Mon Sep 17 00:00:00 2001 From: michael seaman Date: Thu, 13 Mar 2025 19:21:27 -0700 Subject: [PATCH 3/4] fixed snapshot --- src/tests/__snapshots__/Calculator.test.tsx.snap | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tests/__snapshots__/Calculator.test.tsx.snap b/src/tests/__snapshots__/Calculator.test.tsx.snap index 42348f09..4a9e73e8 100644 --- a/src/tests/__snapshots__/Calculator.test.tsx.snap +++ b/src/tests/__snapshots__/Calculator.test.tsx.snap @@ -1,8 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Calculator > should match snapshot 1`] = ` -"

Simple Calculator

-

+"

Total: 0

Previous Total: 0

" `; From da3cba1f793df7adb7f4c6788d3731d1b84969d6 Mon Sep 17 00:00:00 2001 From: michael seaman Date: Thu, 13 Mar 2025 19:55:14 -0700 Subject: [PATCH 4/4] added deploy.yml --- .github/workflows/deploy.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..dad33fc0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,30 @@ +#TODO: What is this line of code doing +name: Deploy + +#TODO: What is this block of code doing +on: + push: + branches: [main] + pull_request: + branches: + - main + +#TODO: What is this block of code doing +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Test + run: | + npm install + npm run test + + - name: Deploy + if: github.ref == 'refs/heads/main' + env: + DEPLOY_URL: ${{ secrets.RENDER_DEPLOY_HOOK_URL }} + run: | + curl "$DEPLOY_URL" + \ No newline at end of file