name: Quality gate on: push: branches: - main pull_request: branches: - main types: [ opened, synchronize, reopened ] jobs: sonar: name: SonarQube Analysis runs-on: ubuntu-latest permissions: write-all steps: - name: โฌ‡๏ธ Checkout Code uses: actions/checkout@v4 with: fetch-depth: 0 - name: ๐Ÿ”ง Setup Python uses: actions/setup-python@v4 with: python-version: "3.11" - name: ๐Ÿ—„๏ธ Cache Python dependencies uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Configure SSH uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Add github.com to known_hosts run: | mkdir -p ~/.ssh ssh-keyscan github.com >> ~/.ssh/known_hosts - name: ๐Ÿ“ฆ Install Dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest pytest-cov pytest-asyncio - name: ๐Ÿงช Run Tests with Pytest run: | pytest tests --junitxml=pytest.xml --cov=ingestor --cov-report=xml --cov-report=term - name: Run SonarQube Analysis uses: SonarSource/sonarqube-scan-action@v5 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}