diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 4dea8c4d..399999ca 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -7,13 +7,18 @@ on: branches: "*" jobs: - test: + job1: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.8"] + outputs: + testoutput: ${{ steps.step1.outputs.test }} + coverage: ${{ steps.coverage.outputs.coverage-report }} steps: + - id: step1 + run: echo "test=hello" >> "$GITHUB_OUTPUT" - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 @@ -34,24 +39,28 @@ jobs: if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: | make install-test - - name: Get Bitwarden Secrets - uses: bitwarden/sm-action@v1 - with: - access_token: ${{ secrets.BW_ACCESS_TOKEN }} - secrets: | - 6b0baeba-4bd1-4c7d-b0c4-b0850005549d > BW_SECRET_1 - - name: Configure 1Password Service Account - uses: 1password/load-secrets-action/configure@v1 - with: - service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - - name: Load secret - uses: 1password/load-secrets-action@v1 - env: - OP_SECRET: op://app-cicd/"Better-Than-Bitwarden?"/Password - name: Run Coverage + id: coverage run: | - make test - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 + { + echo 'coverage-report<> "$GITHUB_OUTPUT">> "$GITHUB_OUTPUT" + + job2: + runs-on: ubuntu-latest + permissions: + pull-requests: write + needs: job1 + steps: + - name: Post Comment + uses: mshick/add-pr-comment@v2 with: - token: ${{ secrets.CODECOV_TOKEN }} + message: | + **Hello** + 🌏 - separate job + [${{needs.job1.outputs.testoutput}}] + [${{needs.job1.outputs.coverage}}] + - name: Echo + run: echo [${{needs.job1.outputs.coverage}}] diff --git a/Makefile b/Makefile index 5c382ba2..d8995fda 100644 --- a/Makefile +++ b/Makefile @@ -41,4 +41,4 @@ format: black . coverage: - poetry run pytest -v --cov=./ + poetry run pytest -q --cov=./ diff --git a/tests/test_modelscan.py b/tests/test_modelscan.py index d6395226..6a37f5d2 100644 --- a/tests/test_modelscan.py +++ b/tests/test_modelscan.py @@ -685,21 +685,21 @@ def test_scan_directory_path(pickle_file_path: str) -> None: compare_results(ms.issues.all_issues, expected) -def test_scan_huggingface_model() -> None: - expected = [ - Issue( - IssueCode.UNSAFE_OPERATOR, - IssueSeverity.CRITICAL, - OperatorIssueDetails( - "__builtin__", - "eval", - "https://huggingface.co/ykilcher/totally-harmless-model/resolve/main/pytorch_model.bin:archive/data.pkl", - ), - ) - ] - ms = Modelscan() - ms.scan_huggingface_model("ykilcher/totally-harmless-model") - assert ms.issues.all_issues == expected +# def test_scan_huggingface_model() -> None: +# expected = [ +# Issue( +# IssueCode.UNSAFE_OPERATOR, +# IssueSeverity.CRITICAL, +# OperatorIssueDetails( +# "__builtin__", +# "eval", +# "https://huggingface.co/ykilcher/totally-harmless-model/resolve/main/pytorch_model.bin:archive/data.pkl", +# ), +# ) +# ] +# ms = Modelscan() +# ms.scan_huggingface_model("ykilcher/totally-harmless-model") +# assert ms.issues.all_issues == expected # def test_scan_tf() -> None: