Skip to content

Commit 580bf7d

Browse files
author
Tom Softreck
committed
update
1 parent 051541c commit 580bf7d

1 file changed

Lines changed: 55 additions & 86 deletions

File tree

.github/workflows/tests.yml

Lines changed: 55 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -24,117 +24,86 @@ jobs:
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828
with:
29-
fetch-depth: 0 # Fetch all history for version tagging
30-
29+
fetch-depth: 0
30+
3131
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v4
32+
uses: actions/setup-python@v5
3333
with:
3434
python-version: ${{ matrix.python-version }}
35-
36-
- name: Cache pip packages
37-
uses: actions/cache@v3
35+
36+
- name: Install Poetry
37+
uses: snok/install-poetry@v1
3838
with:
39-
path: ~/.cache/pip
40-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
41-
restore-keys: |
42-
${{ runner.os }}-pip-
43-
44-
- name: Debug system info
45-
run: |
46-
echo "=== System Information ==="
47-
uname -a
48-
echo "Python version: $(python --version)"
49-
echo "pip version: $(pip --version)"
50-
echo "==========================="
39+
version: 1.7.1
40+
virtualenvs-create: true
41+
virtualenvs-in-project: true
42+
virtualenvs-path: .venv
5143

52-
- name: Install system dependencies
53-
run: |
54-
echo "=== Installing system dependencies ==="
55-
sudo apt-get update
56-
sudo apt-get install -y python3-venv python3-dev
57-
echo "======================================"
44+
- name: Cache Poetry dependencies
45+
uses: actions/cache@v4
46+
with:
47+
path: |
48+
.venv
49+
~/.cache/pypoetry
50+
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
51+
restore-keys: |
52+
poetry-${{ runner.os }}-${{ matrix.python-version }}-
5853
59-
- name: Install Poetry
60-
run: |
61-
echo "=== Installing Poetry ==="
62-
python -m pip install --upgrade pip
63-
python -m pip install --user "poetry==1.5.1"
64-
echo "Poetry version: $(python -m poetry --version)"
65-
echo "Adding Poetry to PATH"
66-
echo "$(python -m site --user-base)/bin" >> $GITHUB_PATH
67-
echo "========================"
68-
69-
- name: Configure Poetry
70-
run: |
71-
echo "=== Configuring Poetry ==="
72-
python -m poetry config virtualenvs.create true
73-
python -m poetry config virtualenvs.in-project true
74-
python -m poetry config --list
75-
echo "Poetry version: $(python -m poetry --version)"
76-
echo "Python executable: $(which python)"
77-
echo "=========================="
78-
7954
- name: Install dependencies
8055
run: |
81-
set -x # Enable debug mode
82-
echo "=== Installing dependencies ==="
83-
echo "Current directory: $(pwd)"
84-
echo "Directory contents:"
85-
ls -la
86-
87-
# First install only the project dependencies (without lock file)
88-
echo "\n=== Installing project dependencies (initial pass) ==="
89-
python -m poetry install --no-interaction --no-ansi -v --only main || \
90-
{ echo "Initial dependency installation failed"; exit 1; }
91-
92-
# Now generate the lock file if it doesn't exist
93-
if [ ! -f poetry.lock ]; then
94-
echo "\n=== Generating poetry.lock ==="
95-
python -m poetry lock --no-update || \
96-
{ echo "Failed to generate poetry.lock"; exit 1; }
97-
fi
98-
99-
# Install all dependencies with the lock file
100-
echo "\n=== Installing all dependencies ==="
101-
python -m poetry install --with dev,test --no-interaction --no-ansi -v || \
102-
{ echo "poetry install with dev/test failed"; exit 1; }
103-
104-
# Verify the environment
105-
echo "\n=== Environment information ==="
106-
python -m poetry env info
107-
108-
echo "\n=== Installed packages ==="
109-
python -m poetry show --tree || echo "Failed to show package tree"
110-
111-
echo "\n=== Python path ==="
112-
python -c "import sys; print('\n'.join(sys.path))"
113-
echo "============================"
114-
56+
poetry install --with dev,test --no-interaction
57+
11558
- name: Run tests with coverage
11659
run: |
117-
poetry run pytest --cov=dialogchain --cov-report=xml
118-
60+
poetry run pytest --cov=dialogchain --cov-report=xml --cov-report=term-missing -v
61+
11962
- name: Upload coverage to Codecov
120-
uses: codecov/codecov-action@v3
63+
uses: codecov/codecov-action@v4
12164
with:
12265
token: ${{ secrets.CODECOV_TOKEN }}
12366
file: ./coverage.xml
12467
fail_ci_if_error: false
125-
68+
12669
- name: Run type checking
12770
run: |
12871
poetry run mypy src/dialogchain tests
129-
72+
13073
- name: Lint with flake8
13174
run: |
13275
poetry run flake8 src/dialogchain tests
133-
76+
13477
- name: Check formatting with black
13578
run: |
13679
poetry run black --check src tests
137-
80+
13881
- name: Check import sorting with isort
13982
run: |
14083
poetry run isort --check-only src tests
84+
85+
# Optional: Add a separate job for dependency security scanning
86+
security:
87+
name: Security Scan
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v4
92+
93+
- name: Set up Python
94+
uses: actions/setup-python@v5
95+
with:
96+
python-version: '3.11'
97+
98+
- name: Install Poetry
99+
uses: snok/install-poetry@v1
100+
with:
101+
version: 1.7.1
102+
103+
- name: Install dependencies
104+
run: poetry install --no-interaction
105+
106+
- name: Run safety check
107+
run: |
108+
poetry run pip install safety
109+
poetry run safety check

0 commit comments

Comments
 (0)