Compare commits

...

3 Commits

Author SHA1 Message Date
cb4bac4b42 ci: segment pytest into standard, fuzz, and live categories
Some checks failed
CI / Lint (ruff) (push) Successful in 11s
CI / SAST (bandit) (push) Successful in 12s
CI / Dependency audit (pip-audit) (push) Successful in 22s
CI / Test (Standard) (3.11) (push) Successful in 1m10s
CI / Test (Standard) (3.12) (push) Successful in 1m13s
CI / Test (Live) (3.11) (push) Has been cancelled
CI / Merge dev → testing (push) Has been cancelled
CI / Prepare Merge to Main (push) Has been cancelled
CI / Finalize Merge to Main (push) Has been cancelled
CI / Test (Fuzz) (3.11) (push) Has been cancelled
2026-04-12 04:17:05 -04:00
8d5944f775 ci: implement automated RC flow and finalize optimizations on dev 2026-04-12 04:15:42 -04:00
ea9f7e734b ci: sequential checks, heavy pytest, and skip ci on auto-merge 2026-04-12 03:55:12 -04:00

View File

@@ -2,7 +2,7 @@ name: CI
on: on:
push: push:
branches: [dev, testing] branches: [dev, testing, "temp/merge-*"]
paths-ignore: paths-ignore:
- "**/*.md" - "**/*.md"
- "docs/**" - "docs/**"
@@ -19,20 +19,6 @@ jobs:
- run: pip install ruff - run: pip install ruff
- run: ruff check . - run: ruff check .
test:
name: Test (pytest)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e .[dev]
- run: pytest tests/ -v --tb=short
bandit: bandit:
name: SAST (bandit) name: SAST (bandit)
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -56,10 +42,55 @@ jobs:
- run: pip install -e .[dev] - run: pip install -e .[dev]
- run: pip-audit --skip-editable - run: pip-audit --skip-editable
test-standard:
name: Test (Standard)
runs-on: ubuntu-latest
needs: [lint, bandit, pip-audit]
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e .[dev]
- run: pytest
test-fuzz:
name: Test (Fuzz)
runs-on: ubuntu-latest
needs: [test-standard]
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e .[dev]
- run: pytest -m fuzz
test-live:
name: Test (Live)
runs-on: ubuntu-latest
needs: [test-standard]
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e .[dev]
- run: pytest -m live
merge-to-testing: merge-to-testing:
name: Merge dev → testing name: Merge dev → testing
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [lint, test, bandit, pip-audit] needs: [test-standard, test-fuzz, test-live]
if: github.ref == 'refs/heads/dev' if: github.ref == 'refs/heads/dev'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -74,37 +105,50 @@ jobs:
run: | run: |
git fetch origin testing git fetch origin testing
git checkout testing git checkout testing
git merge origin/dev --no-ff -m "ci: auto-merge dev → testing" git merge origin/dev --no-ff -m "ci: auto-merge dev → testing [skip ci]"
git push origin testing git push origin testing
open-pr: prepare-merge-to-main:
name: Open PR to main name: Prepare Merge to Main
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [lint, test, bandit, pip-audit] needs: [test-standard, test-fuzz, test-live]
if: github.ref == 'refs/heads/testing' if: github.ref == 'refs/heads/testing'
steps: steps:
- name: Open PR via Gitea API - uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.DECNET_PR_TOKEN }}
- name: Configure git
run: | run: |
echo "--- Checking for existing open PRs ---" git config user.name "DECNET CI"
LIST_RESPONSE=$(curl -s \ git config user.email "ci@decnet.local"
-H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \ - name: Create temp branch and sync with main
"https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls?state=open&head=anti:testing&base=main&limit=5") run: |
echo "$LIST_RESPONSE" git fetch origin main
EXISTING=$(echo "$LIST_RESPONSE" | python3 -c "import sys, json; print(len(json.load(sys.stdin)))") git checkout -b temp/merge-testing-to-main
echo "Open PRs found: $EXISTING" echo "--- Switched to temp branch, merging main into it ---"
if [ "$EXISTING" -gt "0" ]; then git merge origin/main --no-edit || { echo "CONFLICT: Manual resolution required"; exit 1; }
echo "PR already open, skipping." git push origin temp/merge-testing-to-main --force
exit 0
fi finalize-merge-to-main:
echo "--- Creating PR ---" name: Finalize Merge to Main
CREATE_RESPONSE=$(curl -s -X POST \ runs-on: ubuntu-latest
-H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \ needs: [test-standard, test-fuzz, test-live]
-H "Content-Type: application/json" \ if: startsWith(github.ref, 'refs/heads/temp/merge-')
-d '{ steps:
"title": "Auto PR: testing → main", - uses: actions/checkout@v4
"head": "testing", with:
"base": "main", fetch-depth: 0
"body": "All CI and security checks passed on both dev and testing. Review and merge when ready." token: ${{ secrets.DECNET_PR_TOKEN }}
}' \ - name: Configure git
"https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls") run: |
echo "$CREATE_RESPONSE" git config user.name "DECNET CI"
git config user.email "ci@decnet.local"
- name: Merge RC into main
run: |
git fetch origin main
git checkout main
git merge ${{ github.ref }} --no-ff -m "ci: auto-merge testing → main [skip ci]"
git push origin main
echo "--- Cleaning up temp branch ---"
git push origin --delete ${{ github.ref_name }}