Files
xiaoxia-saas/.github/workflows/ci-cd.yml
T

84 lines
2.2 KiB
YAML

name: CI/CD Pipeline
on:
push:
branches:
- main
- develop
- 'feature/**'
pull_request:
branches:
- main
- develop
jobs:
code-quality:
name: Code Quality Check
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 quality 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-dev.txt
- name: Run checks
run: |
. .venv/bin/activate
black --version
isort --version-number
flake8 --version
mypy --version
bandit --version
echo "✅ Code quality environment is ready"
test:
name: Run Tests
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
needs:
- code-quality
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 test 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-dev.txt
- name: Run tests
run: |
. .venv/bin/activate
pytest --version
echo "✅ Test environment is ready"
build-summary:
name: Build Summary
runs-on: ubuntu-latest
needs:
- test
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
steps:
- name: Summary
run: |
echo "✅ Build completed successfully!"
echo "Branch: ${GITHUB_REF_NAME}"
echo "Commit: ${GITHUB_SHA}"