update the pipeline section

This commit is contained in:
mildred 2024-03-13 12:10:10 +01:00
parent 3936eb29ce
commit ae6524bd4c
1 changed files with 30 additions and 64 deletions

View File

@ -7,7 +7,6 @@
- [Usage](#usage) - [Usage](#usage)
- [Test Structure](#test-structure) - [Test Structure](#test-structure)
- [Pipeline Integration](#Pipeline-integration) - [Pipeline Integration](#Pipeline-integration)
- [License](#license)
## Introduction ## Introduction
@ -132,78 +131,45 @@ describe
## Pipeline integration ## Pipeline integration
### GitHub Actions Workflow Configuration for Running Playwright Tests ### Gitea Actions Workflow Configuration for Running Playwright Tests
Following we outline the configuration of a Gitea Actions workflow.
Following we outline the configuration of a GitHub Actions workflow designed to running tests on GitHub using GitHub actions It breaks down the key components of the workflow to ensure clarity and understanding.
```yaml ```yaml
name: Playwright Tests end2end-tests:
on: needs: deploy-testing-instances
push: runs-on: self-hosted
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3 - name: Checkout E2E tests repo
with: uses: actions/checkout@v4
node-version: 18 with:
- name: Install dependencies repository: trustchain-oc1-orchestral/IdHub_E2E_testing
run: npm ci ref: master
- name: Install Playwright Browsers token: ${{ secrets.SSIKIT_TOKEN }}
run: npx playwright install --with-deps
- name: Run Playwright tests - name: Install dependencies
run: npx playwright test run: |
- uses: actions/upload-artifact@v3 npm ci
- name: Install Playwright browsers
run: |
npx playwright install --with-deps
- name: Run Playwright tests
run: |
npx playwright test
```
**Adding reporting**: Uploads the `playwright-report/` directory as an artifact named `playwright-report`. This step always runs, even if previous steps fail, and the artifact is retained for 30 days before automatic deletion.
- uses: actions/upload-artifact@v3
if: always() if: always()
with: with:
name: playwright-report name: playwright-report
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
```
#### Workflow Name
- **Workflow Name**: The name of this workflow is "Playwright Tests". This identifier is used within GitHub Actions to reference this workflow.
#### Trigger Events
- **Push to Main or Master Branches**: The workflow is triggered on any push event to the `main` or `master` branches.
- **Pull Requests to Main or Master Branches**: Similarly, the workflow is also triggered upon any pull request that targets the `main` or `master` branches.
#### Jobs
- **Jobs**: The workflow defines a job named `test`. This job is executed when the workflow is triggered.
#### Job Configuration
- **Timeout**: A timeout of 60 minutes is set for this job. If the job exceeds this time, it will be automatically canceled.
- **Environment**: The job is configured to run on the latest version of Ubuntu provided by GitHub Actions.
#### Steps
1. **Checkout Repository**: The first step checks out the repository, allowing the workflow to access it.
- `uses: actions/checkout@v3`
2. **Setup Node.js Environment**: Sets up a Node.js environment using the specified version (Node.js 18).
- `uses: actions/setup-node@v3` with `node-version: 18`
3. **Install Dependencies**: Installs the project dependencies using `npm ci`, leveraging the `package-lock.json` for precise dependency versions.
- `run: npm ci`
4. **Install Playwright Browsers**: Installs the necessary Playwright browsers along with all necessary system dependencies using `npx playwright install --with-deps`.
- `run: npx playwright install --with-deps`
5. **Run Playwright Tests**: Executes the Playwright tests using `npx playwright test`.
- `run: npx playwright test`
6. **Upload Artifact**: Uploads the `playwright-report/` directory as an artifact named `playwright-report`. This step always runs, even if previous steps fail, and the artifact is retained for 30 days before automatic deletion.
- `uses: actions/upload-artifact@v3` with `if: always()`, `name: playwright-report`, `path: playwright-report/`, and `retention-days: 30`
### Summary
This workflow automates the process of running Playwright tests on pushes and pull requests to the `main` and `master` branches, ensuring that code changes do not break existing functionality. It includes steps for setting up the environment, installing dependencies, installing necessary browsers for Playwright, running the tests, and uploading test reports as artifacts for review.
## License
[Include information about the project's license.]