Skip to content

Commit 45a7721

Browse files
authored
chore: hotfixing the pkgutil.ImpImporter error when using 3.12 based pipx; adding dependabot; patching snapshot tests (#73)
* fix: testing ci * chore: testing ci * chore: test * chore: test * chore: testing ci * chore: testing ci * chore: test * chore: testing * chore: test * chore: test * chore: removing tmp tweak * chore: testing ci * chore: lockfile maintenance (poetry update); reverting ci tweaks * chore: testing ci * chore: testing ci * chore: testing ci
1 parent 28308a0 commit 45a7721

File tree

7 files changed

+436
-342
lines changed

7 files changed

+436
-342
lines changed
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "Python Poetry Action"
2+
description: "An action to setup Poetry"
3+
runs:
4+
using: "composite"
5+
steps:
6+
# A workaround for pipx isn't installed on M1 runner.
7+
# We should remove it after this issue is resolved.
8+
# https://github.com/actions/runner-images/issues/9256
9+
- if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }}
10+
run: |
11+
pip install poetry
12+
shell: bash
13+
14+
# NOTE: Below commands currently causes a faulty behaviour in pipx where
15+
# preinstalled pipx on github worker has shared venv instantiated via python 3.10
16+
# however 2 of the above commands are supposed to reinstall pipx and use python version
17+
# specified in setup-python, however shared venv still uses 3.10 hence algokit fails on
18+
# pkgutil.ImpImporter module not found error.
19+
# To be approached as given until further clarified on corresponding issues on pipx repo.
20+
# ------
21+
# pip install --user pipx
22+
# pipx ensurepath
23+
# ------
24+
- if: ${{ runner.os != 'macOS' || runner.arch != 'ARM64' }}
25+
run: |
26+
pipx install poetry ${{ runner.os == 'macOS' && '--python "$Python_ROOT_DIR/bin/python"' || '' }}
27+
shell: bash
28+
29+
- name: Get full Python version
30+
id: full-python-version
31+
shell: bash
32+
run: echo "full_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')" >> $GITHUB_OUTPUT
33+
34+
- name: Setup poetry cache
35+
uses: actions/cache@v4
36+
with:
37+
path: ./.venv
38+
key: venv-${{ hashFiles('poetry.lock') }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.full-python-version.outputs.full_version }}

.github/dependabot.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
commit-message:
8+
prefix: "chore(deps)"
9+
groups:
10+
all:
11+
patterns:
12+
- "*"
13+
update-types:
14+
- "minor"
15+
- "patch"

.github/workflows/build-python.yaml

+4-18
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,15 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
steps:
1313
- name: Checkout source code
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
- name: Set up Python ${{ matrix.python }}
17-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: ${{ matrix.python }}
2020

21-
- name: Install pipx
22-
run: |
23-
python -m pip install --upgrade pip
24-
python -m pip install pipx
25-
python -m pipx ensurepath
26-
27-
- name: Cache Poetry
28-
uses: actions/cache@v2
29-
with:
30-
path: ~/.local/share/pipx/venvs/poetry
31-
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
32-
restore-keys: |
33-
${{ runner.os }}-poetry-
34-
35-
- name: Install poetry
36-
run: pipx install poetry
21+
- name: Set up Poetry
22+
uses: ./.github/actions/setup-poetry
3723

3824
- name: Install dependencies
3925
run: poetry install --no-interaction

.github/workflows/cd.yaml

+6-7
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,18 @@ jobs:
3434
runs-on: ubuntu-latest
3535

3636
steps:
37-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3838
with:
3939
# Fetch entire repository history so we can determine version number from it
4040
fetch-depth: 0
4141

42-
- name: Install poetry
43-
run: pipx install poetry
44-
4542
- name: Set up Python
46-
uses: actions/setup-python@v4
43+
uses: actions/setup-python@v5
4744
with:
4845
python-version: "3.10"
49-
cache: "poetry"
46+
47+
- name: Set up Poetry
48+
uses: ./.github/actions/setup-poetry
5049

5150
- name: Install dependencies
5251
run: poetry install --no-interaction --no-root
@@ -87,4 +86,4 @@ jobs:
8786
env:
8887
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8988
REPOSITORY_USERNAME: __token__
90-
REPOSITORY_PASSWORD: ${{ secrets.PYPI_API_KEY }}
89+
REPOSITORY_PASSWORD: ${{ secrets.PYPI_API_KEY }}

.github/workflows/check-python.yaml

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ jobs:
88
runs-on: "ubuntu-latest"
99
steps:
1010
- name: Checkout source code
11-
uses: actions/checkout@v3
12-
13-
- name: Install poetry
14-
run: pipx install poetry
11+
uses: actions/checkout@v4
1512

1613
- name: Set up Python 3.10
17-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1815
with:
1916
python-version: "3.10"
20-
cache: "poetry"
17+
18+
- name: Set up Poetry
19+
uses: ./.github/actions/setup-poetry
2120

2221
- name: Install dependencies
2322
run: poetry install --no-interaction --no-root

0 commit comments

Comments
 (0)