Skip to content

Commit

Permalink
Added SONAR and COVERALLS tokens to environment for nox job
Browse files Browse the repository at this point in the history
  • Loading branch information
clyde-johnston committed Aug 20, 2023
1 parent 0f3ae51 commit a07f49c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019-npcap]
python: ['3.7', '3.8', '3.9', '3.10']
os: [ ubuntu-20.04, windows-2019-npcap ]
python: [ '3.7', '3.8', '3.9', '3.10' ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out
Expand Down Expand Up @@ -52,6 +52,8 @@ jobs:
run: |
nox --non-interactive --error-on-missing-interpreters --session test pristine --python ${{ matrix.python }}
nox --non-interactive --session demo check_style docs
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Save logs
uses: actions/upload-artifact@v3
Expand Down
18 changes: 15 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,26 @@ def test(session):
session.run("pylint", *map(str, src_dirs), env={"PYTHONPATH": str(compiled_dir)})

# Publish coverage statistics. This also has to be run from the test session to access the coverage files.
if sys.platform.startswith("linux") and is_latest_python(session) and session.env.get("COVERALLS_REPO_TOKEN"):
if sys.platform.startswith("linux") and is_latest_python(session):
session.install("coveralls")
session.run("coveralls")
session.run("coveralls", "--verbose")
#session.run("echo", f"{coveralls_service_number}", "-----", external=True)
#session.run(
# "coveralls", "--service=github", "--verbose",
# env={
# "GITHUB_TOKEN": f"{github_token}",
# "GITHUB_ACTIONS": f"{github_actions}",
# "COVERALLS_SERVICE_NAME": f"{coveralls_service_name}",
# "COVERALLS_SERVICE_NUMBER": f"{coveralls_service_number}",
# "COVERALLS_SKIP_SSL_VERIFY": "1"
# }
#)
# session.run("coveralls", "--service=github", env={"GITHUB_TOKEN": f"{github_token}", "GITHUB_ACTIONS": f"{github_actions}"})
else:
session.log("Coveralls skipped")

# Submit analysis to SonarCloud. This also has to be run from the test session to access the coverage files.
sonarcloud_token = session.env.get("SONARCLOUD_TOKEN")
sonarcloud_token = session.env.get("SONAR_TOKEN")
if sys.platform.startswith("linux") and is_latest_python(session) and sonarcloud_token:
session.run("coverage", "xml", "-i", "-o", str(ROOT_DIR / ".coverage.xml"))

Expand Down

0 comments on commit a07f49c

Please sign in to comment.