Skip to content

Merge branch 'dev' of https://github.com/vlecture/vlecture-api into dev #260

Merge branch 'dev' of https://github.com/vlecture/vlecture-api into dev

Merge branch 'dev' of https://github.com/vlecture/vlecture-api into dev #260

Workflow file for this run

name: Sonarqube
on:
push:
branches:
- main
- dev
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.12
- name: "Create env file"
run: |
touch .env
echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} >> .env
echo AWS_BUCKET_NAME=${{ secrets.DEV_AWS_BUCKET_NAME }} >> .env
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} >> .env
echo TESTDB_URL=${{ secrets.TESTDB_URL }} >> .env
echo POSTGRES_HOST=${{ secrets.POSTGRES_HOST }} >> .env
echo POSTGRES_DB=${{ secrets.POSTGRES_DB }} >> .env
echo POSTGRES_PORT=${{ secrets.POSTGRES_PORT }} >> .env
echo POSTGRES_USER=${{ secrets.POSTGRES_USER }} >> .env
echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env
echo MONGODB_URL=${{ secrets.DEV_MONGODB_URL }} >> .env
echo MONGODB_URL_RW=${{ secrets.MONGODB_URL_RW }} >> .env
echo MONGODB_URL_MAJORITY=${{ secrets.MONGODB_URL_MAJORITY }} >> .env
echo MONGODB_URL_CLUSTER=${{ secrets.DEV_MONGODB_URL_CLUSTER }} >> .env
echo MONGODB_DB_NAME=${{ secrets.MONGODB_DB_NAME }} >> .env
echo MONGODB_COLLECTION_NOTE=${{ secrets.MONGODB_COLLECTION_NOTE }} >> .env
echo MONGODB_COLLECTION_QNA=${{ secrets.MONGODB_COLLECTION_QNA }} >> .env
echo MONGODB_COLLECTION_QNA_RESULTS=${{ secrets.MONGODB_COLLECTION_QNA_RESULTS }} >> .env
echo MAIL_USERNAME=${{ secrets.MAIL_USERNAME }} >> .env
echo MAIL_PASSWORD=${{ secrets.MAIL_PASSWORD }} >> .env
echo MAIL_FROM=${{ secrets.MAIL_FROM }} >> .env
echo MAIL_PORT=${{ secrets.MAIL_PORT }} >> .env
echo MAIL_SERVER=${{ secrets.MAIL_SERVER }} >> .env
echo MAIL_FROM_NAME=${{ secrets.MAIL_FROM_NAME }} >> .env
echo MAIL_STARTTLS=${{ secrets.MAIL_STARTTLS }} >> .env
echo MAIL_SSL_TLS=${{ secrets.MAIL_SSL_TLS }} >> .env
echo USE_CREDENTIALS=${{ secrets.USE_CREDENTIALS }} >> .env
echo VALIDATE_CERTS=${{ secrets.VALIDATE_CERTS }} >> .env
echo OPENAI_API_KEY=${{ secrets.DEV_OPENAI_API_KEY }} >> .env
echo OTP_SECRET=${{ secrets.OTP_SECRET }} >> .env
echo OTP_LIFESPAN_SEC=${{ secrets.OTP_LIFESPAN_SEC }} >> .env
echo ACCESS_TOKEN_SECRET=${{ secrets.ACCESS_TOKEN_SECRET }} >> .env
echo REFRESH_TOKEN_SECRET=${{ secrets.REFRESH_TOKEN_SECRET }} >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
- name: Install tox and any other packages
run: pip install tox
- name: Run tox
run: tox -e py -- -m coverage run --source=src -m pytest --cov-fail-under=0
- name: Upload coverage report as artifact
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: coverage-report
path: htmlcov/index.html
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@d3ca1743de4293fc030a2e1ded1fb44088b80b76 # master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}