init
This commit is contained in:
parent
9fdc393cd4
commit
4a63635e84
@ -213,7 +213,7 @@ spec:
|
|||||||
-depth="${PARAM_DEPTH}" \
|
-depth="${PARAM_DEPTH}" \
|
||||||
-sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}"
|
-sparseCheckoutDirectories="${PARAM_SPARSE_CHECKOUT_DIRECTORIES}"
|
||||||
cd "${CHECKOUT_DIR}"
|
cd "${CHECKOUT_DIR}"
|
||||||
ls -al
|
|
||||||
RESULT_SHA="$(git rev-parse HEAD)"
|
RESULT_SHA="$(git rev-parse HEAD)"
|
||||||
EXIT_CODE="$?"
|
EXIT_CODE="$?"
|
||||||
if [ "${EXIT_CODE}" != 0 ] ; then
|
if [ "${EXIT_CODE}" != 0 ] ; then
|
||||||
|
@ -6,8 +6,8 @@ spec:
|
|||||||
params:
|
params:
|
||||||
- name: subdirectory
|
- name: subdirectory
|
||||||
type: string
|
type: string
|
||||||
description: Subdirectory within the repo where the tests are located
|
description: Subdirectory within the workspace where the tests are located
|
||||||
default: ""
|
default: "" # 기본값을 빈 문자열로 설정, 필요 시 repo로 변경
|
||||||
- name: python-version
|
- name: python-version
|
||||||
type: string
|
type: string
|
||||||
description: Python version to use (e.g., 3.9, 3.11)
|
description: Python version to use (e.g., 3.9, 3.11)
|
||||||
@ -16,32 +16,39 @@ spec:
|
|||||||
- name: source
|
- name: source
|
||||||
description: Workspace containing the cloned Git repository from git-clone-checkout
|
description: Workspace containing the cloned Git repository from git-clone-checkout
|
||||||
steps:
|
steps:
|
||||||
|
- name: debug-workspace
|
||||||
|
image: ubuntu
|
||||||
|
workingDir: /workspace/source
|
||||||
|
script: |
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "Listing contents of /workspace/source:"
|
||||||
|
ls -la
|
||||||
|
if [ -n "$(params.subdirectory)" ]; then
|
||||||
|
if [ -d "$(params.subdirectory)" ]; then
|
||||||
|
echo "Subdirectory $(params.subdirectory) exists:"
|
||||||
|
ls -la $(params.subdirectory)
|
||||||
|
else
|
||||||
|
echo "Subdirectory $(params.subdirectory) not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
- name: install-dependencies
|
- name: install-dependencies
|
||||||
image: python:$(params.python-version)-slim
|
image: python:$(params.python-version)-slim
|
||||||
workingDir: /workspace/source
|
workingDir: /workspace/source
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
ls -al /workspace/source
|
|
||||||
|
|
||||||
if [ -n "$(params.subdirectory)" ]; then
|
if [ -n "$(params.subdirectory)" ]; then
|
||||||
cd $(params.subdirectory)
|
cd $(params.subdirectory)
|
||||||
fi
|
fi
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
# Poetry가 있는 경우 설치 및 의존성 처리
|
pip install pytest
|
||||||
if [ -f pyproject.toml ]; then
|
if [ -f pyproject.toml ]; then
|
||||||
echo "Detected Poetry project (pyproject.toml found)"
|
|
||||||
pip install poetry
|
pip install poetry
|
||||||
poetry config virtualenvs.in-project true
|
poetry config virtualenvs.in-project true
|
||||||
poetry install --no-root
|
poetry install --no-root
|
||||||
# Pip fallback (requirements.txt)
|
|
||||||
elif [ -f requirements.txt ]; then
|
elif [ -f requirements.txt ]; then
|
||||||
echo "Detected Pip project (requirements.txt found)"
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
else
|
|
||||||
echo "No dependency file found, installing pytest only"
|
|
||||||
fi
|
fi
|
||||||
pip install pytest # pytest는 항상 설치
|
|
||||||
- name: run-tests
|
- name: run-tests
|
||||||
image: python:$(params.python-version)-slim
|
image: python:$(params.python-version)-slim
|
||||||
workingDir: /workspace/source
|
workingDir: /workspace/source
|
||||||
@ -50,13 +57,12 @@ spec:
|
|||||||
if [ -n "$(params.subdirectory)" ]; then
|
if [ -n "$(params.subdirectory)" ]; then
|
||||||
cd $(params.subdirectory)
|
cd $(params.subdirectory)
|
||||||
fi
|
fi
|
||||||
# Poetry가 사용된 경우 가상환경에서 실행
|
|
||||||
if [ -f pyproject.toml ]; then
|
if [ -f pyproject.toml ]; then
|
||||||
poetry run pytest --verbose --junitxml=/workspace/source/pytest-results.xml
|
poetry run pytest --verbose --junitxml=/workspace/source/pytest-results.xml
|
||||||
else
|
else
|
||||||
pytest --verbose --junitxml=/workspace/source/pytest-results.xml
|
pytest --verbose --junitxml=/workspace/source/pytest-results.xml
|
||||||
fi
|
fi
|
||||||
onError: continue # 테스트 실패 시에도 파이프라인을 중단하지 않음 (선택적)
|
onError: continue
|
||||||
- name: check-results
|
- name: check-results
|
||||||
image: ubuntu
|
image: ubuntu
|
||||||
workingDir: /workspace/source
|
workingDir: /workspace/source
|
||||||
|
Loading…
x
Reference in New Issue
Block a user