From 62493aafb2844b7e06f721e7071291ca37956c0d Mon Sep 17 00:00:00 2001 From: Alphena-EK <101400276+Alphena-EK@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:04:54 +0300 Subject: [PATCH] Update quality.yml --- .github/workflows/quality.yml | 64 ++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 21ec7c608..6706b987e 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -23,40 +23,86 @@ jobs: include: - python-version: 3.9 toxenv: py39,style,coverage-ci - - python-version: 3.10.9 + os: ubuntu-latest + - python-version: 3.10 toxenv: py310,style,coverage-ci + os: ubuntu-latest - python-version: 3.11 toxenv: py311,style,coverage-ci + os: macos-latest - python-version: 3.12 toxenv: py312,style,coverage-ci + os: windows-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/checkout@v4 with: submodules: recursive - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Setup python - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c + fetch-depth: 0 + + - name: Cache Python Dependencies + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: python-${{ matrix.python-version }}-pip-${{ runner.os }}-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + python-${{ matrix.python-version }}-pip-${{ runner.os }}- + + - name: Setup Python + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + + - name: Cache Node.js Dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: node-${{ matrix.os }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + node-${{ matrix.os }}- + - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '20' - - name: Install dependencies + + - name: Install Dependencies run: | pip install --upgrade virtualenv pip install tox npm --prefix plugins/magma install npm --prefix plugins/magma run build - - name: Run tests + + - name: Run Tests env: TOXENV: ${{ matrix.toxenv }} run: tox + - name: Override Coverage Source Path for Sonar run: sed -i "s/\/home\/runner\/work\/caldera\/caldera/\/github\/workspace/g" /home/runner/work/caldera/caldera/coverage.xml + - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@49e6cd3b187936a73b8280d59ffd9da69df63ec9 + uses: SonarSource/sonarcloud-github-action@v3 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + notify: + runs-on: ubuntu-latest + needs: build + if: failure() + steps: + - name: Send Failure Notification + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 587 + username: ${{ secrets.SMTP_USERNAME }} + password: ${{ secrets.SMTP_PASSWORD }} + subject: "GitHub Actions Failed" + body: | + Job Name: Code Quality + Repository: ${{ github.repository }} + Branch: ${{ github.ref }} + Commit: ${{ github.sha }} + to: your-email@example.com