rc #513
This file contains 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: Unit-Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
test: | |
# Prevent circular workflow run | |
if: "!contains(github.event.pusher.name, 'emnify-gha')" | |
name: Run Unit-Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
pip install pipenv | |
pipenv install --deploy --ignore-pipfile --dev | |
- name: Run tests | |
run: pipenv run pytest --cov=. --cov-report=xml | |
- name: Export SonarCloud Result | |
# Skip dependabot runs because they don't have access to secrets | |
if: "!contains(github.ref, 'dependabot')" | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdk-coverage-result | |
path: coverage.xml |