Skip to content

Commit

Permalink
cicd: update workflows and readme info
Browse files Browse the repository at this point in the history
  • Loading branch information
krsiakdaniel committed Mar 5, 2024
1 parent b3c9fae commit 20e3574
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 48 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 20.x
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20.x
- run: npm ci
- run: npm test
node-version: 18
- name: Install dependencies
run: npm ci
- name: Run JEST tests
run: npm test
42 changes: 23 additions & 19 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
name: Playwright Tests

on:
push:
branches: [ main, master ]
branches:
- master
pull_request:
branches: [ main, master ]
branches:
- master

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
70 changes: 47 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,33 +175,25 @@ npx playwright codegen

This app uses GitHub Actions for CI and Netlify for CD.

### GitHub Actions
### CI - Continuous Integration

Workflow files in project root:

- [jest.yml](.github/workflows/jest.yml)
- [playwright.yml](.github/workflows/playwright.yml)

Workflows on GitHub:

- [actions/workflows/jest.yml](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/jest.yml)
- [actions/workflows/playwright.yml](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/playwright.yml)

### CI - Continuous Integration 🚦
[![Jest](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/jest.yml/badge.svg)](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/jest.yml)

This app uses GitHub Actions for CI.

Status:
#### GitHub Actions - Workflow "Jest"

[![Jest](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/jest.yml/badge.svg)](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/jest.yml)
- Workflow file: [jest.yml](.github/workflows/jest.yml)
- View the results on GitHub: [actions/workflows/playwright.yml](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/playwright.yml)

#### GitHub Actions - Workflow "Jest"
<details>
<summary>Read workflow description ...</summary>

File location: [.github/workflows/jest.yml](.github/workflows/jest.yml)
---

This workflow ensures that tests are run in a clean environment for every push and pull request to the `master` branch. You can view the results of the workflow in the **["Actions"](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions) tab of GitHub repository**.
This GitHub Actions workflow is named **"Jest"**.

This workflow is triggered in 2 scenarios:
It is triggered in 2 scenarios:

1. When a push is made to the `master` branch.
2. When a pull request is opened against the `master` branch.
Expand All @@ -210,12 +202,44 @@ The workflow consists of a single job named `build`, which is executed on the la

The `build` job follows these steps:

1. It checks out your repository using the `actions/checkout@v2` action.
2. It sets up a Node.js environment using the `actions/setup-node@v2` action, specifically using Node.js version 14.x.
3. It installs the dependencies of your project using `npm ci`. This command is similar to `npm install`, but it's designed to be used in automated environments such as this one. It's faster and more reliable because it bypasses a package's `package.json` to install modules from a package's `npm-shrinkwrap.json` or `package-lock.json`, and it doesn't modify these `lock` files.
4. It runs your Jest tests using `npm test`.
1. Checkout the repository using the `actions/checkout@v3` action.
2. Setup Node.js environment using the `actions/setup-node@v3` action with Node.js version 18.
3. It installs the dependencies of your project using `npm ci`. This command is similar to `npm install`, but it's designed to be used in automated environments such as this one.
4. Run JEST tests using `npm test`.

</details>

#### GitHub Actions - Workflow "Playwright"

- Workflow files in project root: [playwright.yml](.github/workflows/playwright.yml)
- View the results on GitHub: [actions/workflows/playwright.yml](https://github.com/krsiakdaniel/portfolio-website-krsiak-cz/actions/workflows/playwright.yml)

<details>
<summary>Read workflow description ...</summary>

---

It is triggered in 2 scenarios:

1. When a push is made to the `master` branch.
2. When a pull request is opened against `master` branch.

The workflow consists of a single job named `test`, which is executed on the latest version of Ubuntu.

The `test` job follows these steps:

1. Checkout the repository using the `actions/checkout@v3` action.
2. Setup Node.js environment using the `actions/setup-node@v3` action with Node.js version 18.
3. It installs the dependencies of your project using `npm ci`. This command is similar to `npm install`, but it's designed to be used in automated environments such as this one.
4. Install Playwright browsers using `npx playwright install --with-deps`.
5. Run Playwright tests using `npx playwright test`.
6. Upload the test report as an artifact using the `actions/upload-artifact@v3` action. This step is always executed regardless of the success or failure of previous steps. The artifact is named `playwright-report`, it is located at the `playwright-report/` path, and it is retained for 30 days.

</details>

### CD - Continuous Deployment

### CD - Continuous Deployment [![Build Status](https://badges.netlify.com/api/portfolio-website-krsiak-cz.svg?branch=master)](https://app.netlify.com/sites/portfolio-website-krsiak-cz/deploys)
[![Build Status](https://badges.netlify.com/api/portfolio-website-krsiak-cz.svg?branch=master)](https://app.netlify.com/sites/portfolio-website-krsiak-cz/deploys)

This app is deployed on Netlify.

Expand Down

0 comments on commit 20e3574

Please sign in to comment.