Spaces:
Runtime error
Runtime error
copilot-swe-agent[bot]
dewitt4
Add explicit GITHUB_TOKEN permissions to workflow for security
5722793 Download .github/workflows/ci.yml from Safe-Harbor/LLMGuardian: direct link, hf CLI and curl.
- Browser
- Download file 2.89 kB
-
https://huggingface.co/spaces/Safe-Harbor/LLMGuardian/resolve/main/.github/workflows/ci.yml
- Command line
-
hf download hf://spaces/Safe-Harbor/LLMGuardian/.github/workflows/ci.yml
-
curl -L -o ci.yml https://huggingface.co/spaces/Safe-Harbor/LLMGuardian/resolve/main/.github/workflows/ci.yml
2.89 kB
| name: CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint Code | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.8' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev,test]" | |
| - name: Run Black | |
| run: | | |
| black --check src tests | |
| - name: Run Flake8 | |
| run: | | |
| flake8 src tests | |
| continue-on-error: true | |
| - name: Run isort | |
| run: | | |
| isort --check-only src tests | |
| - name: Run mypy | |
| run: | | |
| mypy src | |
| continue-on-error: true | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev,test]" | |
| - name: Run tests with pytest | |
| run: | | |
| mkdir -p test-results/pytest | |
| pytest tests/ --junitxml=test-results/pytest/results.xml --cov=src --cov-report=xml --cov-report=term | |
| continue-on-error: true | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.python-version }} | |
| path: test-results/ | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.python-version == '3.9' | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| continue-on-error: true | |
| build: | |
| name: Build Package | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.8' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build wheel setuptools | |
| pip install -e ".[dev,test]" | |
| - name: Build package | |
| run: | | |
| python -m build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-packages | |
| path: dist/ | |