Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83bfab1

Browse files
committed
Using default python image as base
1 parentb7dcdc2 commit83bfab1

File tree

5 files changed

+86
-23
lines changed

5 files changed

+86
-23
lines changed

‎.github/workflows/test.yml‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,24 @@ jobs:
3838
3939
-name:Build test environment
4040
run:|
41+
# Check if Python Docker image exists and get the appropriate version
42+
PYTHON_VERSION=$(bash scripts/check_python_docker_image.sh "${{ matrix.python-version }}")
43+
echo "Using Python version: ${PYTHON_VERSION}"
44+
45+
# Export for docker compose
46+
export PYTHON_VERSION="${PYTHON_VERSION}"
47+
export PYTHON_VERSION_SHORT="${{ matrix.python-version }}"
48+
4149
# Build the docker compose services
42-
docker compose build \
43-
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
44-
--build-arg PYTHON_VERSION_SHORT=${{ matrix.python-version }}
50+
docker compose build python-mode-tests
4551
4652
-name:Run test suite
4753
run:|
54+
# Get the appropriate Python version
55+
PYTHON_VERSION=$(bash scripts/check_python_docker_image.sh "${{ matrix.python-version }}")
56+
4857
# Set Python version environment variables
49-
export PYTHON_VERSION="${{ matrix.python-version }}"
58+
export PYTHON_VERSION="${PYTHON_VERSION}"
5059
export PYTHON_VERSION_SHORT="${{ matrix.python-version }}"
5160
export TEST_SUITE="${{ matrix.test-suite }}"
5261
export GITHUB_ACTIONS=true

‎Dockerfile‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
ARG PYTHON_VERSION_SHORT
22
ARG PYTHON_VERSION
3-
ARG REPO_OWNER=python-mode
4-
FROM ghcr.io/${REPO_OWNER}/python-mode-base:${PYTHON_VERSION_SHORT}-latest
3+
# Use official Python slim image instead of non-existent base
4+
# Note: For Python 3.13, use 3.13.0 if just "3.13" doesn't work
5+
FROM python:${PYTHON_VERSION}-slim
56

67
ENV PYTHON_VERSION=${PYTHON_VERSION}
78
ENV PYTHONUNBUFFERED=1
89
ENV PYMODE_DIR="/workspace/python-mode"
910

11+
# Install system dependencies required for testing
12+
RUN apt-get update && apt-get install -y \
13+
vim-nox \
14+
git \
15+
curl \
16+
bash \
17+
&& rm -rf /var/lib/apt/lists/*
18+
1019
# Set up working directory
1120
WORKDIR /workspace
1221

@@ -23,18 +32,13 @@ RUN mkdir -p /root/.vim/pack/foo/start/ && \
2332
# Initialize git submodules
2433
WORKDIR /workspace/python-mode
2534

26-
# Create a script to run tests
35+
# Create asimplifiedscript to run tests (no pyenv needed with official Python image)
2736
RUN echo'#!/bin/bash\n\
28-
# export PYENV_ROOT="/opt/pyenv"\n\
29-
# export PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"\n\
30-
eval "$(pyenv init -)"\n\
31-
eval "$(pyenv init --path)"\n\
32-
# Use specified Python version\n\
33-
pyenv shell ${PYTHON_VERSION}\n\
3437
cd /workspace/python-mode\n\
35-
echo "Using Python: $(python --version)"\n\
38+
echo "Using Python: $(python3 --version)"\n\
39+
echo "Using Vim: $(vim --version | head -1)"\n\
3640
bash ./tests/test.sh\n\
37-
rm -f tests/.swo tests/.swp 2>&1 >/dev/null\n\
41+
rm -f tests/.swo tests/.swp 2>&1 >/dev/null\n\
3842
' > /usr/local/bin/run-tests && \
3943
chmod +x /usr/local/bin/run-tests
4044

‎docker-compose.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ services:
44
context:.
55
dockerfile:Dockerfile
66
args:
7-
-PYTHON_VERSION_SHORT
8-
-PYTHON_VERSION
7+
-PYTHON_VERSION_SHORT=${PYTHON_VERSION_SHORT:-3.11}
8+
-PYTHON_VERSION=${PYTHON_VERSION:-3.11}
99
volumes:
1010
# Mount the current directory to allow for development and testing
1111
-.:/workspace/python-mode
@@ -25,8 +25,8 @@ services:
2525
context:.
2626
dockerfile:Dockerfile
2727
args:
28-
-PYTHON_VERSION_SHORT
29-
-PYTHON_VERSION
28+
-PYTHON_VERSION_SHORT=${PYTHON_VERSION_SHORT:-3.11}
29+
-PYTHON_VERSION=${PYTHON_VERSION:-3.11}
3030
volumes:
3131
-.:/workspace/python-mode
3232
environment:
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# Script to check if a Python Docker image exists and provide fallback
3+
4+
PYTHON_VERSION="${1:-3.11}"
5+
6+
# In CI environment, use simpler logic without pulling
7+
if [-n"$GITHUB_ACTIONS" ];then
8+
# For Python 3.13 in CI, use explicit version
9+
if [["$PYTHON_VERSION"=="3.13" ]];then
10+
echo"3.13.0"
11+
else
12+
echo"$PYTHON_VERSION"
13+
fi
14+
exit 0
15+
fi
16+
17+
# Function to check if Docker image exists (for local development)
18+
check_docker_image() {
19+
local image="$1"
20+
local version="$2"
21+
# Try to inspect the image without pulling
22+
if docker image inspect"$image">/dev/null2>&1;then
23+
echo"$version"
24+
return 0
25+
fi
26+
# Try pulling if not found locally
27+
if docker pull"$image" --quiet2>/dev/null;then
28+
echo"$version"
29+
return 0
30+
fi
31+
return 1
32+
}
33+
34+
# For Python 3.13, try specific versions
35+
if [["$PYTHON_VERSION"=="3.13" ]];then
36+
# Try different Python 3.13 versions
37+
forversionin"3.13.0""3.13""3.13-rc""3.13.0rc3";do
38+
if check_docker_image"python:${version}-slim""${version}";then
39+
exit 0
40+
fi
41+
done
42+
# If no 3.13 version works, fall back to 3.12
43+
echo"Warning: Python 3.13 image not found, using 3.12 instead">&2
44+
echo"3.12"
45+
else
46+
# For other versions, return as-is
47+
echo"$PYTHON_VERSION"
48+
fi

‎scripts/dual_test_runner.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
frompathlibimportPath
99

1010
defrun_legacy_tests():
11-
"""Run the legacy bash test suite"""
11+
"""Run the legacy bash test suite using docker compose"""
1212
print("🔧 Running Legacy Bash Test Suite...")
1313
try:
14+
# Use the main docker-compose.yml with python-mode-tests service
1415
result=subprocess.run([
15-
"bash","tests/test.sh"
16+
"docker","compose","run","--rm","python-mode-tests"
1617
],
1718
cwd=Path(__file__).parent.parent,
1819
capture_output=True,
@@ -36,11 +37,12 @@ def run_legacy_tests():
3637
returnFalse
3738

3839
defrun_vader_tests():
39-
"""Run the Vader test suite usingdocker compose"""
40+
"""Run the Vader test suite usingthe run-vader-tests.sh script"""
4041
print("⚡ Running Vader Test Suite...")
4142
try:
43+
# Use the existing run-vader-tests.sh script which handles Docker setup
4244
result=subprocess.run([
43-
"docker","compose","run","--rm","test-vader"
45+
"bash","scripts/run-vader-tests.sh"
4446
],
4547
cwd=Path(__file__).parent.parent,
4648
capture_output=True,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp