Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<<EOF'
make coverage
echo EOF
} >> "$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}}]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ format:
black .

coverage:
poetry run pytest -v --cov=./
poetry run pytest -q --cov=./
30 changes: 15 additions & 15 deletions tests/test_modelscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down