Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hotfixing the pkgutil.ImpImporter error when using 3.12 based pipx; adding dependabot; patching snapshot tests #72

Merged
merged 16 commits into from
Apr 16, 2024
38 changes: 38 additions & 0 deletions .github/actions/setup-poetry/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Python Poetry Action"
description: "An action to setup Poetry"
runs:
using: "composite"
steps:
# A workaround for pipx isn't installed on M1 runner.
# We should remove it after this issue is resolved.
# https://github.com/actions/runner-images/issues/9256
- if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }}
run: |
pip install poetry
shell: bash

# NOTE: Below commands currently causes a faulty behaviour in pipx where
# preinstalled pipx on github worker has shared venv instantiated via python 3.10
# however 2 of the above commands are supposed to reinstall pipx and use python version
# specified in setup-python, however shared venv still uses 3.10 hence algokit fails on
# pkgutil.ImpImporter module not found error.
# To be approached as given until further clarified on corresponding issues on pipx repo.
# ------
# pip install --user pipx
# pipx ensurepath
# ------
- if: ${{ runner.os != 'macOS' || runner.arch != 'ARM64' }}
run: |
pipx install poetry ${{ runner.os == 'macOS' && '--python "$Python_ROOT_DIR/bin/python"' || '' }}
shell: bash

- name: Get full Python version
id: full-python-version
shell: bash
run: echo "full_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')" >> $GITHUB_OUTPUT

- name: Setup poetry cache
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.full-python-version.outputs.full_version }}
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps)"
groups:
all:
patterns:
- "*"
update-types:
- "minor"
- "patch"
22 changes: 4 additions & 18 deletions .github/workflows/build-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,15 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Install pipx
run: |
python -m pip install --upgrade pip
python -m pip install pipx
python -m pipx ensurepath

- name: Cache Poetry
uses: actions/cache@v2
with:
path: ~/.local/share/pipx/venvs/poetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-

- name: Install poetry
run: pipx install poetry
- name: Set up Poetry
uses: ./.github/actions/setup-poetry

- name: Install dependencies
run: poetry install --no-interaction
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Fetch entire repository history so we can determine version number from it
fetch-depth: 0

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"

- name: Set up Poetry
uses: ./.github/actions/setup-poetry

- name: Install dependencies
run: poetry install --no-interaction --no-root
Expand Down Expand Up @@ -87,4 +86,4 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_USERNAME: __token__
REPOSITORY_PASSWORD: ${{ secrets.PYPI_API_KEY }}
REPOSITORY_PASSWORD: ${{ secrets.PYPI_API_KEY }}
11 changes: 5 additions & 6 deletions .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"

- name: Set up Poetry
uses: ./.github/actions/setup-poetry

- name: Install dependencies
run: poetry install --no-interaction --no-root
Expand Down
Loading