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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..ddaa3743 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 \ 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 ( 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`] = ` -"
Total: 0
Previous Total: 0
" `;