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 @@
# .github/workflows/cd.yml
name: Deploying to Github Pages
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Fetch repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: |
yarn
- name: Building
run: |
NODE_ENV=production yarn build
- name: Uploading production artifacts
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: dist

deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Publishing production artifact
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: github-pages
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .github/workflows/ci.yml
name: CI/CD Pipeline
on: [pull_request, workflow_dispatch]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Fetch repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: |
yarn
- name: Run unit tests
run: |
NODE_ENV=production yarn test
linting:
runs-on: ubuntu-latest
steps:
- name: Fetch repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: |
yarn
- name: Lint code
run: |
yarn lint
2 changes: 1 addition & 1 deletion src/calculator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test('subtract 1 + 2 to equal -1', () => {
});

test('divide 1 / 2 to equal 0.5', () => {
expect(divide(1, 2)).toBe(0.4);
expect(divide(1, 2)).toBe(0.5);
});

test('multiply 1 * 2 to equal 2', () => {
Expand Down