Fix: Remove hardcoded sudo from Docker command #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python Application CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Setup Hadolint | |
| run: | | |
| curl -sL -o hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64 | |
| chmod +x hadolint | |
| sudo mv hadolint /usr/local/bin/ | |
| - name: Setup Trivy | |
| run: | | |
| curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.43.1 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Build package | |
| run: | | |
| pip install build | |
| python -m build | |
| - name: Install package in development mode | |
| run: | | |
| pip install -e . | |
| - name: Run Hadolint on Dockerfiles | |
| run: | | |
| find . -name "Dockerfile*" -exec hadolint {} \; | |
| - name: Run Trivy for vulnerability scanning | |
| run: | | |
| find . -name "Dockerfile*" -exec trivy config {} \; | |
| - name: Debug folder structure | |
| run: | | |
| echo "Current directory: $(pwd)" | |
| ls -R | |
| - name: Run tests | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| docksec -h | |
| docksec --ai-only ./testfiles/2/Dockerfile | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| if-no-files-found: ignore |