Skip to content

F2 #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

F2 #32

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
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -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"

42 changes: 42 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Name of workflow
name: Lint and Test workflow

# Trigger workflow on all pull requests
on:
pull_request:
branches:
- develop
- staging

# Jobs to carry out
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

# Run build
- name: Run Build
run: npm run build

# Run tests
- name: Run Tests
run: npm run test
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Advertisement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ interface AdvertisementProps {
companyName: string;
productDescription: string;
price: string;
};
}

function Advertisement(props: AdvertisementProps) {
return (
Expand Down
3 changes: 1 addition & 2 deletions src/tests/__snapshots__/Calculator.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Calculator > should match snapshot 1`] = `
"<h2>Simple Calculator</h2>
<p><input type="text" id="value" value="0" name="value"></p><button class="btn btn-primary" type="button"> Add </button>
"<p><input type="text" id="value" value="0" name="value"></p><button class="btn btn-primary" type="button"> Add </button>
<p class="card-text">Total: 0</p>
<p class="card-text">Previous Total: 0</p>"
`;