Skip to content

Guiliano's doc update #126

Guiliano's doc update

Guiliano's doc update #126

Workflow file for this run

# SPDX-FileCopyrightText: Copyright 2025 Siemens AG
#
# SPDX-License-Identifier: Apache-2.0
name: Check code quality
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
# Stage 1: fast and basic checks, we run them in parallel to provide more feedback to the contributor at once,
# instead of running them sequentially and giving feedback one piece at a time, requiring more iterations.
ruff_lint:
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Code style
run: ruff check
license_check:
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: License check
run: reuse lint
rf_style_check:
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: RobotFramework style check
run: robocop check --ignore VAR04
# We haven't settled on a style for RobotFramework yet, enforce check when consensus is reached
continue-on-error: true
spelling_check:
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Spelling checker
run: codespell . --check-filenames --skip *.html,*.pem,*.xml,*venv*,*fips/*.py,*/announcement.py,./data/rfc_test_vectors/*
dependency_check:
# See if newer versions of our Python dependencies are available. This does
# not enforce anything, and only has an informational character.
runs-on: ubuntu-22.04
continue-on-error: true
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
steps:
- name: Check for outdated dependencies
run: |
echo "Checking for outdated packages..."
OUTDATED=$(pip list --outdated --format=columns)
if [ -z "$OUTDATED" ]; then
echo "All packages are up to date!"
exit 0
else
echo "Outdated packages detected, think about it:"
echo "$OUTDATED"
exit 1
fi
version_check:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Ensure version is referenced in CHANGELOG.md
run: |
VERSION=$(cat VERSION)
if ! grep -E "^# $VERSION" CHANGELOG.md; then
echo "Error: CHANGELOG.md does not contain an entry for version $VERSION."
exit 1
fi
# ----------------------------------------------------------------------------
# Stage 2: these checks are more expensive and do more with the code, e.g., attempt to import dependencies,
# execute some logic, etc.
pylint:
needs: [ruff_lint, license_check, rf_style_check, spelling_check]
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Pylint check
run: pylint --fail-under=9.4 resources
unit_test:
needs: [ruff_lint, license_check, rf_style_check, spelling_check]
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
env:
OQS_INSTALL_PATH: "/root/_oqs"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Unit tests
run: python3 -m unittest discover -s unit_tests
type_check:
runs-on: ubuntu-22.04
container:
image: ghcr.io/${{ github.repository_owner }}/cmp-test-dev:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Pyright check
run: pyright
# not enforced yet, but it is still executed to provide some info
continue-on-error: true
prepare_env:
runs-on: ubuntu-22.04
outputs:
image_lc: ${{ steps.setenv.outputs.image_lc }}
steps:
- name: Set lowercase image name
id: setenv
run: |
OWNER_LC=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
IMAGE_LC="ghcr.io/${OWNER_LC}/cmp-test-dev:latest"
echo "image_lc=$IMAGE_LC" >> $GITHUB_OUTPUT