[CONFIG] Node script for github-actions, sonarcloud automatic scan di… #25
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 CI Coverage | |
on: | |
push: | |
branches: [ "main", "develop", "feature/*" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
LOG_LEVEL: INFO | |
jobs: | |
build: | |
name: "Run CI" | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest"] | |
python: ['3.12'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup Python | |
uses: actions/setup-python@master | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install | |
run: | | |
pip3 install -r requirements.txt | |
- name: Test | |
run: | | |
coverage run -m pytest --verbose -o log_cli=true --log-cli-level=INFO src/ | |
- name: Coverage | |
run: | | |
coverage report | |
- name: Upload coverage reports to Codecov with GitHub Action | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
verbose: true # optional (default = false) | |
- name: Install tox and any other packages | |
run: pip install tox | |
- name: Run tox | |
run: tox -e py | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |