- Speed up simulation 10x for integration tests (reduces test time from 10+ minutes to ~2.5 minutes) - Add small delays between TCP commands in tests for reliability - Fix Gitea CI release job (use gitea.ref instead of github.ref) - Revert write() error-check that was consuming query responses
110 lines
2.7 KiB
YAML
110 lines
2.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master, main]
|
|
tags: ['v*']
|
|
pull_request:
|
|
branches: [master, main]
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install ruff
|
|
|
|
- name: Run Ruff
|
|
run: ruff check src/ tests/
|
|
|
|
typecheck:
|
|
name: Type Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
|
|
- name: Run mypy
|
|
run: mypy src/
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -e ".[dev]"
|
|
|
|
- name: Run pytest
|
|
run: pytest --cov=src/py_dvt_ate --cov-report=xml
|
|
|
|
- name: Check coverage
|
|
run: |
|
|
coverage report --fail-under=80 || echo "Coverage below 80% - will enforce after MVP"
|
|
|
|
release:
|
|
name: Release
|
|
needs: [lint, typecheck, test]
|
|
if: startsWith(gitea.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install build tools
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install build
|
|
|
|
- name: Build package
|
|
run: python -m build
|
|
|
|
- name: Upload Release Assets
|
|
run: |
|
|
# Create release using Gitea API
|
|
TAG_NAME=${GITEA_REF#refs/tags/}
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\": \"${TAG_NAME}\", \"name\": \"${TAG_NAME}\", \"body\": \"Release ${TAG_NAME}\"}" \
|
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" || true
|
|
|
|
# Upload dist files
|
|
for file in dist/*; do
|
|
curl -X POST \
|
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
-F "attachment=@${file}" \
|
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/tags/${TAG_NAME}/assets?name=$(basename ${file})" || true
|
|
done
|