name: Test Suite on: push: branches: [main, develop] pull_request: branches: [main] jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Lint with flake8 run: flake8 wikijs tests --max-line-length=88 --ignore=E203,E501,W503 - name: Format check with black run: black --check wikijs tests --line-length=88 - name: Import sort check run: isort --check-only wikijs tests --line-length=88 - name: Type check with mypy run: mypy wikijs test: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Run unit tests run: pytest tests/ -v --cov=wikijs --cov-report=xml --cov-report=term-missing - name: Upload coverage report uses: actions/upload-artifact@v4 if: matrix.python-version == '3.11' with: name: coverage-report path: | ./coverage.xml ./tests/htmlcov/ security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e ".[dev]" - name: Run security scan with bandit run: bandit -r wikijs -f json -o bandit-report.json || true - name: Upload security report uses: actions/upload-artifact@v4 with: name: security-report path: bandit-report.json package: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.11" - name: Install build dependencies run: | python -m pip install --upgrade pip pip install build twine - name: Build package run: python -m build - name: Check package run: twine check dist/* - name: Upload package artifacts uses: actions/upload-artifact@v4 with: name: python-package path: dist/