Playwright Tests #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
number_of_runs: | |
description: 'Number of runs' | |
required: false | |
default: 30 | |
type: number | |
number_of_iterations: | |
description: 'Number of iterations' | |
required: false | |
default: 10 | |
type: number | |
jobs: | |
setup-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- id: set-matrix | |
run: | | |
echo "Creating a matrix with ${{ github.event.inputs.number_of_runs }} runs" | |
matrix="{\"instance\": [" | |
for i in $(seq 1 ${{ github.event.inputs.number_of_runs }}); do | |
matrix+="\"$i\"" | |
if [ $i -lt ${{ github.event.inputs.number_of_runs }} ]; then | |
matrix+=", " | |
fi | |
done | |
matrix+="]}" | |
echo "Matrix: $matrix" | |
echo "::set-output name=matrix::$matrix" | |
test: | |
needs: setup-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{fromJson(needs.setup-matrix.outputs.matrix)}} | |
max-parallel: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: macnev2013/p_pw_mg | |
token: ${{ secrets.ACCESS_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Cache Python dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
/home/runner/.cache/ms-playwright | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Ensure browsers are installed | |
run: python -m playwright install | |
- name: Running iterations ${{ github.event.inputs.number_of_iterations }} times | |
run: | | |
for i in $(seq 1 ${{ github.event.inputs.number_of_iterations }}); do | |
echo "Running instance $i" | |
python main.py | |
done | |
env: | |
EMAIL: ${{ secrets.EMAIL }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
LOGIN_URL: ${{ secrets.LOGIN_URL }} | |
BROWSER_STATE: ${{ secrets.BROWSER_STATE_1 }} |