Skip to content

Add new message definitions for streaming events #42

Add new message definitions for streaming events

Add new message definitions for streaming events #42

Workflow file for this run

name: Test PR
on:
pull_request:
env:
# Please make sure this version is included in the `matrix`, as the
# `matrix` section can't use `env`, so it must be entered manually
DEFAULT_PYTHON_VERSION: '3.11'
# It would be nice to be able to also define a DEFAULT_UBUNTU_VERSION
# but sadly `env` can't be used either in `runs-on`.
jobs:
validate-structure:
name: Validate Python Package Structure
runs-on: ubuntu-latest # Using latest as specific version isn't critical here
steps:
- uses: actions/checkout@v4
- name: Check for __init__.py files
run: |
echo "Checking if Python package structure mirrors Protobuf structure..."
PROTO_BASE="proto/frequenz/api/common"
PYTHON_BASE="py/frequenz/api/common"
MISSING_INIT=false # Initialize flag
# Use process substitution to avoid subshell issues with the while loop
while IFS= read -r proto_dir; do
# Construct the corresponding python path
relative_path="${proto_dir#$PROTO_BASE/}"
# Handle the base directory case
if [ "$proto_dir" == "$PROTO_BASE" ]; then
relative_path=""
fi
python_dir="$PYTHON_BASE/$relative_path"
# Check if the corresponding python directory exists
if [ -d "$python_dir" ]; then
# Check if __init__.py exists in the python directory
if [ ! -f "$python_dir/__init__.py" ]; then
echo "Error: Missing __init__.py in $python_dir (corresponding to $proto_dir)"
MISSING_INIT=true # Set the flag
fi
# Optional check for missing python directories
# else
# echo "Warning: Python directory $python_dir not found for proto directory $proto_dir"
fi
done < <(find "$PROTO_BASE" -type d) # Feed find output via process substitution
# Check the flag after the loop finishes
if [ "$MISSING_INIT" = true ]; then
echo "Validation failed: Found missing __init__.py files."
exit 1
else
echo "Validation successful: All corresponding Python directories have __init__.py."
fi
protolint:
name: Check proto files with protolint
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/[email protected]
- name: Fetch sources
uses: actions/checkout@v4
with:
submodules: true
- name: Run protolint
# Only use hashes here, as we are passing the github token, we want to
# make sure updates are done consciously to avoid security issues if the
# action repo gets hacked
uses: yoheimuta/action-protolint@e62319541dc5107df5e3a5010acb8987004d3d25 # v1.3.0
with:
fail_on_error: true
filter_mode: nofilter
github_token: ${{ secrets.github_token }}
protolint_flags: proto/
protolint_version: "0.52.0"
reporter: github-check
nox:
name: Test with nox
runs-on: ubuntu-24.04
steps:
- name: Run nox
uses: frequenz-floss/[email protected]
with:
python-version: "3.11"
nox-session: ci_checks_max
test-docs:
name: Test documentation website generation
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/[email protected]
- name: Fetch sources
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: frequenz-floss/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
- name: Generate the documentation
env:
MIKE_VERSION: gh-${{ github.job }}
run: |
mike deploy $MIKE_VERSION
mike set-default $MIKE_VERSION
- name: Upload site
uses: actions/upload-artifact@v4
with:
name: docs-site
path: site/
if-no-files-found: error