|
| 1 | +name: 'Setup Python, Poetry, and Playwright' |
| 2 | +description: 'Set up Python, install Poetry, cache dependencies, install Playwright, and install all dependencies with Poetry.' |
| 3 | + |
| 4 | +inputs: |
| 5 | + python-version: |
| 6 | + description: 'Version of Python to use.' |
| 7 | + required: true |
| 8 | + default: '3.12' |
| 9 | + gh-organization-token: |
| 10 | + description: 'GitHub Access Token with access to the organization’s repositories for authentication and dependency management.' |
| 11 | + required: true |
| 12 | + |
| 13 | +runs: |
| 14 | + using: 'composite' |
| 15 | + steps: |
| 16 | + - name: Checkout LFS objects |
| 17 | + shell: bash |
| 18 | + run: git lfs checkout |
| 19 | + |
| 20 | + - name: Set up Python ${{ inputs.python-version }} |
| 21 | + uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: ${{ inputs.python-version }} |
| 24 | + |
| 25 | + - name: Install Poetry |
| 26 | + uses: snok/install-poetry@v1 |
| 27 | + with: |
| 28 | + virtualenvs-create: true |
| 29 | + virtualenvs-in-project: true |
| 30 | + installer-parallel: true |
| 31 | + |
| 32 | + - name: Cache Python dependencies |
| 33 | + uses: actions/cache@v4 |
| 34 | + id: poetry-cache |
| 35 | + with: |
| 36 | + path: .venv |
| 37 | + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} |
| 38 | + |
| 39 | + - name: Verify Python and Poetry installation |
| 40 | + shell: bash |
| 41 | + run: | |
| 42 | + python --version |
| 43 | + poetry --version |
| 44 | +
|
| 45 | + - name: Install dependencies with Poetry |
| 46 | + shell: bash |
| 47 | + run: | |
| 48 | + poetry config experimental.system-git-client true --local |
| 49 | + poetry install --no-interaction --no-root |
| 50 | +
|
| 51 | + - name: Get installed Playwright version |
| 52 | + id: playwright-version |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + PLAYWRIGHT_VERSION=$(poetry show playwright | grep "version" | awk '{print $3}') |
| 56 | + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> "$GITHUB_ENV" |
| 57 | +
|
| 58 | + - name: Cache Playwright dependencies |
| 59 | + uses: actions/cache@v4 |
| 60 | + id: playwright-cache |
| 61 | + with: |
| 62 | + path: ~/.cache/ms-playwright/ |
| 63 | + key: playwright-${{ runner.os }}-${{ env.PLAYWRIGHT_VERSION }} |
| 64 | + |
| 65 | + - name: Install Playwright dependencies with Poetry |
| 66 | + shell: bash |
| 67 | + run: poetry run playwright install chromium --with-deps |
| 68 | + |
| 69 | + - name: Verify Playwright installation |
| 70 | + shell: bash |
| 71 | + run: | |
| 72 | + poetry run playwright -V |
0 commit comments