Skip to content

Commit

Permalink
Merge branch 'main' into kasiah/python-311
Browse files Browse the repository at this point in the history
  • Loading branch information
KasiaHinkson authored Nov 14, 2024
2 parents b05ea7a + a9b45c2 commit 828d97a
Show file tree
Hide file tree
Showing 29 changed files with 629 additions and 168 deletions.
34 changes: 18 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,60 +20,62 @@ jobs:
# Documentation CI
docs-build:
docker:
- image: cimg/python:3.10
- image: cimg/python:3.12
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v2-dependencies-python3.10-{{ checksum "./docs/requirements.txt" }}
- v2-dependencies-python3.12-{{ checksum "./docs/requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-python3.10-
- v2-dependencies-python3.12-
- run:
name: Install dependencies
# Note that we the circleci node image installs stuff with a user "circleci", rather
# than root. So we need to tell npm where to install stuff.
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r ./docs/requirements.txt
pip install uv
uv venv
source .venv/bin/activate
uv pip install -r ./docs/requirements.txt
- save_cache:
paths:
- ./venv
key: v2-dependencies-python3.10-{{ checksum "./docs/requirements.txt" }}
key: v2-dependencies-python3.12-{{ checksum "./docs/requirements.txt" }}
- run:
name: Build docs
command: |
. venv/bin/activate
source .venv/bin/activate
cd docs/
make deploy_docs
cd ..
docs-build-deploy:
docker:
- image: cimg/python:3.10-node
- image: cimg/python:3.12-node
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v2-dependencies-python3.10-{{ checksum "./docs/requirements.txt" }}
- v2-dependencies-python3.12-{{ checksum "./docs/requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v2-dependencies-python3.10-
- v2-dependencies-python3.12-
- run:
name: Install dependencies
# Note that we the circleci node image installs stuff with a user "circleci", rather
# than root. So we need to tell npm where to install stuff.
command: |
npm set prefix=/home/circleci/npm
npm install -g --silent [email protected]
python3 -m venv venv
. venv/bin/activate
pip install -r ./docs/requirements.txt
pip install uv
uv venv
source .venv/bin/activate
uv pip install -r ./docs/requirements.txt
- save_cache:
paths:
- ./venv
key: v2-dependencies-python3.10-{{ checksum "./docs/requirements.txt" }}
key: v2-dependencies-python3.12-{{ checksum "./docs/requirements.txt" }}
- add_ssh_keys:
# This SSH key is "CircleCI Docs" in https://github.com/move-coop/parsons/settings/keys
# We need write access to the Parsons repo, so we can push the "gh-pages" branch.
Expand All @@ -85,7 +87,7 @@ jobs:
# (This file tell Github Pages that we want to include all files in docs/, including those
# that start with an underscore like _static/).
command: |
. venv/bin/activate
source .venv/bin/activate
cd docs/
make deploy_docs
cd ..
Expand Down
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: docker
directory: /
schedule:
interval: weekly

- package-ecosystem: pip
directory: /docs
schedule:
interval: weekly

- package-ecosystem: pip
directory: /
schedule:
interval: weekly
28 changes: 28 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required,
# PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
name: Dependency review

on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: 'Dependency Review'
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
168 changes: 168 additions & 0 deletions .github/workflows/python-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Python checks

on:
push:
branches: [ "main", "major-release" ]
pull_request:
branches: [ "main", "major-release" ]
workflow_dispatch:

permissions:
contents: read

jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
limited-dependencies: ["", "TRUE"]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12

- name: Install dependencies
env:
PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }}
run: |
uv pip install --system -e .[all]
uv pip install --system -r requirements-dev.txt
- name: Test with pytest
run: |
pytest
ruff-format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.12"

- name: Install uv
uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12

- name: Install dependencies
run: |
uv pip install --system -r requirements-dev.txt
- name: Run ruff format
run: |
ruff format --diff --target-version=py38 .
ruff:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.12"

- name: Install uv
uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12

- name: Install dependencies
run: |
uv pip install --system -r requirements-dev.txt
- name: Run ruff
run: |
ruff check --output-format=github .
bandit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.12"

- name: Install uv
uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12

- name: Install bandit
run: |
uv pip install --system -r requirements-dev.txt
- name: Run bandit scan
run: |
bandit -c pyproject.toml -r . -ll -ii
coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.12
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.12"

- name: Install uv
uses: install-pinned/uv@de03c60d508703a83d3f8f49afcf1249590ecda1 # 0.4.12

- name: Install dependencies
run: |
uv pip install --system -e .[all]
uv pip install --system -r requirements-dev.txt
- name: Test with pytest
run: |
coverage run -m pytest
- name: Check coverage
run: |
coverage report -m --skip-covered --fail-under=75
pip-install:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
limited-dependencies: ["", "TRUE"]

runs-on: ${{ matrix.os }}

steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
env:
PARSONS_LIMITED_DEPENDENCIES: ${{ matrix.limited-dependencies }}
run: |
pip install -r requirements-dev.txt
pip install -e .[all]
79 changes: 79 additions & 0 deletions .github/workflows/security_scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# 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
pull_request:
branches: [ "main", "major-release" ]
schedule:
- cron: '45 16 * * 2'

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
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: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

- name: "Checkout code"
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.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

# 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
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@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
with:
sarif_file: results.sarif
Loading

0 comments on commit 828d97a

Please sign in to comment.