Files
xiaoxia-saas/.github/workflows/ci-cd.yml
T
2026-06-19 07:22:17 +08:00

60 lines
1.7 KiB
YAML

name: CI/CD Pipeline
on:
push:
branches:
- main
- develop
- 'feature/**'
- 'bugfix/**'
- 'hotfix/**'
- 'release/**'
pull_request:
branches:
- main
- develop
jobs:
validate:
name: Validate Code Quality And Tests
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
steps:
- name: Checkout code
run: |
git clone --depth=1 --branch=${GITHUB_REF_NAME} https://api.xiaoxiajianji.com/git/${GITHUB_REPOSITORY}.git .
git checkout ${GITHUB_SHA}
- name: Prepare environment
run: |
python3 --version
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --index-url https://pypi.org/simple --upgrade pip
python -m pip install --index-url https://pypi.org/simple -r requirements-quality.txt
python -m pip install --index-url https://pypi.org/simple -r requirements-dev.txt
- name: Run code quality checks
run: |
. .venv/bin/activate
python -m black --version
python -m isort --version-number
python -m flake8 --version
python -m mypy --version
bandit --version
echo "✅ Code quality environment is ready"
- name: Run tests
run: |
. .venv/bin/activate
pytest --version
echo "✅ Test environment is ready"
- name: Build summary
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
run: |
echo "✅ Build completed successfully!"
echo "Branch: ${GITHUB_REF_NAME}"
echo "Commit: ${GITHUB_SHA}"