Skip to content

Commit

Permalink
feat: enhance CI/CD pipeline with unit and e2e testing
Browse files Browse the repository at this point in the history
Introduce a new GitHub Actions workflow for running unit tests. The
workflow is triggered on every push to the main branch. It sets up a
Node.js environment, installs dependencies, and runs the unit tests.

In addition, the deployment workflow now depends on the successful
completion of both the unit testing and Playwright end-to-end testing
workflows. This ensures that the code is thoroughly tested before it
is deployed.

Finally, the semantic release workflow has been updated to depend on
the successful completion of the deployment workflow. This ensures
that a new release is only created after the tested and deployed code
is in production.
  • Loading branch information
amalv committed Jan 6, 2024
1 parent 60008d9 commit d11b147
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
workflow_run:
workflows: ["Run Tests", "Run Playwright Tests"]
types:
- completed

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -29,11 +30,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 12
cache: "npm"
- name: Install dependencies
run: npm install
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Playwright Tests
name: Run Playwright Tests
on:
push:
branches: [main, master]
branches: [main]
pull_request:
branches: [main, master]
branches: [main]
jobs:
test:
timeout-minutes: 60
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
name: Semantic Release

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
workflow_run:
workflows: ["Deploy static content to Pages"]
types:
- completed

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -15,11 +16,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: "npm"
- name: Install dependencies
run: npm install
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Run Tests

on:
push:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Install dependencies
run: npm install
- name: Run unit tests
run: npm test

0 comments on commit d11b147

Please sign in to comment.