diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..aa0e5de --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,78 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '34 23 * * 6' + push: + branches: [ "main" ] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + # `publish_results: true` only works when run from the default branch. conditional can be removed if disabled. + if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request' + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore + # file_mode: git + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 814b68d..d6028f3 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -15,26 +15,27 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] - + python-version: ['3.9', '3.10', '3.11', '3.12'] + env: + UV_PYTHON_DOWNLOADS: never steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install UV + uses: astral-sh/setup-uv@v6 - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install . - pip install flake8 pytest - if [ -f dev_requirements.txt ]; then pip install -r dev_requirements.txt; fi + uv venv --python ${{ matrix.python-version }} + uv sync --python ${{ matrix.python-version }} --group dev - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names - flake8 openleadr/ --count --select=E9,F63,F7,F82 --show-source --statistics + uv run flake8 openleadr/ --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 openleadr/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + uv run flake8 openleadr/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest -vv test/ + uv run pytest -vv test/ diff --git a/README.md b/README.md index 52441b3..be3974d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Test Coverage](https://openleadr.org/coverage/badge.svg)](https://openleadr.org/coverage) ![PyPI Downloads](https://img.shields.io/pypi/dm/openleadr?color=lightblue&label=PyPI%20Downloads) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4317/badge)](https://bestpractices.coreinfrastructure.org/projects/4317) + [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/OpenLEADR/openleadr-python/badge)](https://scorecard.dev/viewer/?uri=github.com/OpenLEADR/openleadr-python) ![OpenLEADR](https://openleadr.org/images/lf-logo.png) diff --git a/dev_requirements.txt b/dev_requirements.txt index 9ccadbf..38dd10a 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,6 @@ termcolor pytest pytest-asyncio +cryptography<40 sphinx -sphinxcontrib-apidoc \ No newline at end of file +sphinxcontrib-apidoc diff --git a/setup.py b/setup.py index e084d9f..fc7c1c5 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ project_urls={'GitHub': 'https://github.com/openleadr/openleadr-python', 'Documentation': 'https://openleadr.org/docs'}, packages=['openleadr', 'openleadr.service'], - python_requires='>=3.7.0', + python_requires='>=3.8.0', include_package_data=True, - install_requires=['xmltodict==0.13.0', 'aiohttp>=3.8.3,<4.0.0', 'apscheduler>=3.10.0,<4.0.0', 'jinja2>=3.1.2,<4.0.0', 'signxml==3.2.1'], + install_requires=['xmltodict==0.13.0', 'aiohttp>=3.8.3,<4.0.0', 'apscheduler>=3.10.0,<4.0.0', 'jinja2>=3.1.2,<4.0.0','cryptography<40', 'signxml==3.2.1'], entry_points={'console_scripts': ['fingerprint = openleadr.fingerprint:show_fingerprint']})