-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (73 loc) · 2.22 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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)}}
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 }}