From 026c8a476fdcca5a016a6ec8cb3ee5023efd8d6b Mon Sep 17 00:00:00 2001 From: Andrew Lamkin <25615947+lamkina@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:06:36 -0800 Subject: [PATCH 1/3] Workflow for merge protection for specific named branches (#19) --- .github/workflows/branch-name-check.yml | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/branch-name-check.yml diff --git a/.github/workflows/branch-name-check.yml b/.github/workflows/branch-name-check.yml new file mode 100644 index 0000000..4f2612c --- /dev/null +++ b/.github/workflows/branch-name-check.yml @@ -0,0 +1,61 @@ +name: Branch Name Check + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + branches: + - main + - dev + - 'client-*' + +jobs: + check-branch-name: + runs-on: ubuntu-latest + steps: + - name: Check branch name for main + if: github.base_ref == 'main' + run: | + BRANCH_NAME="${{ github.head_ref }}" + echo "Source branch: $BRANCH_NAME" + echo "Target branch: ${{ github.base_ref }}" + + if [[ $BRANCH_NAME == dev ]] || [[ $BRANCH_NAME == hotfix-* ]]; then + echo "Branch name is valid" + exit 0 + else + echo "Invalid branch name for main pull request" + echo "Branch name must be dev or start with 'hotfix-'" + exit 1 + fi + + - name: Check branch name for dev + if: github.base_ref == 'dev' + run: | + BRANCH_NAME="${{ github.head_ref }}" + echo "Source branch: $BRANCH_NAME" + echo "Target branch: ${{ github.base_ref }}" + + if [[ $BRANCH_NAME == hotfix-* ]] || [[ $BRANCH_NAME == feature-* ]] || [[ $BRANCH_NAME == bugfix-* ]]; then + echo "Branch name is valid" + exit 0 + else + echo "Invalid branch name for dev pull request" + echo "Branch name must start with 'hotfix-', 'feature-', or 'bugfix-'" + exit 1 + fi + + - name: Check branch name for client branches + if: startsWith(github.base_ref, 'client-') + run: | + BRANCH_NAME="${{ github.head_ref }}" + echo "Source branch: $BRANCH_NAME" + echo "Target branch: ${{ github.base_ref }}" + + if [[ $BRANCH_NAME == feature-* ]] || [[ $BRANCH_NAME == bugfix-* ]] || [[ $BRANCH_NAME == hotfix-* ]]; then + echo "Branch name is valid" + exit 0 + else + echo "Invalid branch name for client pull request" + echo "Branch name must start with 'feature-', 'bugfix-', or 'hotfix-'" + exit 1 + fi \ No newline at end of file From 3eed3198b3810ab75c96109e62e0c8d866f99248 Mon Sep 17 00:00:00 2001 From: Eirikur Jonsson <36180221+eirikurj@users.noreply.github.com> Date: Tue, 25 Nov 2025 14:20:48 +0000 Subject: [PATCH 2/3] Adding mypy as an option to run (#21) * adding mypy as an option to run * updates to input params * do not create a report * update call --- README.md | 1 + azure/README.md | 3 ++- azure/azure_style.yaml | 24 ++++++++++++++++++++++++ azure/azure_template.yaml | 7 ++++++- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9c726c0..6b306c3 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ This repo stores the following shared repository settings/configurations/templat - `isort` - `pylint` - `codecov` + - `mypy` - Shared configurations for Azure Pipelines - Shared configurations for GitHub Actions - Issue/PR labels shared across the organization diff --git a/azure/README.md b/azure/README.md index cda1b47..32c5aed 100644 --- a/azure/README.md +++ b/azure/README.md @@ -27,11 +27,12 @@ The templates are organized into the following files: | `COVERAGE` | boolean | `false` | Flag to report test coverage to `codecov` | | `TIMEOUT_STYLE` | number | `10` | Runtime allowed for each style check, in minutes | | `IGNORE_STYLE` | boolean | `false` | Flag to allow `formatting and linting` checks to fail without failing the pipeline | -| `BASE_FORMAT_AND_LINT` | boolean | `false` | Flag to trigger the `base_format_and_lint` check | +| `BASE_FORMAT_AND_LINT` | boolean | `true` | Flag to trigger the `base_format_and_lint` check | | `ISORT` | boolean | `false` | Flag to trigger the `isort` check | | `PYLINT` | boolean | `false` | Flag to trigger the `pylint` check | | `CLANG_FORMAT` | boolean | `false` | Flag to trigger the `clang-format` check | | `FPRETTIFY` | boolean | `false` | Flag to trigger the `fprettify` check | +| `MYPY` | boolean | `false` | Flag to trigger the `mypy` check | | `TAPENADE` | boolean | `false` | Flag to trigger the Tapenade check | | `TIMEOUT_TAPENADE` | number | `10` | Runtime allowed for the Tapenade check, in minutes | | `TAPENADE_SCRIPT` | string | `.github/build_tapenade.sh` | Path to Bash script with commands to run Tapenade | diff --git a/azure/azure_style.yaml b/azure/azure_style.yaml index 210017f..2236365 100644 --- a/azure/azure_style.yaml +++ b/azure/azure_style.yaml @@ -23,6 +23,9 @@ parameters: - name: FPRETTIFY type: boolean default: false + - name: MYPY + type: boolean + default: false jobs: - job: base_format_and_lint pool: @@ -153,4 +156,25 @@ jobs: # Exit with an error if any of the tracked files changed git diff --summary --exit-code + - job: mypy + pool: + vmImage: "ubuntu-22.04" + timeoutInMinutes: ${{ parameters.TIMEOUT }} + continueOnError: ${{ parameters.IGNORE_STYLE }} + condition: ${{ parameters.MYPY }} + steps: + - checkout: self + - checkout: azure_template + - task: UsePythonVersion@0 + inputs: + versionSpec: "3.11" + - script: | + cd ${{ parameters.REPO_NAME }} + + pip install wheel + pip install mypy + + # Run mypy check (should pick up local config from mypy.ini or .mypy.ini if present) + mypy + diff --git a/azure/azure_template.yaml b/azure/azure_template.yaml index 4a3bb66..76e21f5 100644 --- a/azure/azure_template.yaml +++ b/azure/azure_template.yaml @@ -42,6 +42,9 @@ parameters: - name: IGNORE_STYLE type: boolean default: false + - name: BASE_FORMAT_AND_LINT + type: boolean + default: true - name: ISORT type: boolean default: false @@ -54,7 +57,7 @@ parameters: - name: FPRETTIFY type: boolean default: false - - name: RUFF + - name: MYPY type: boolean default: false # Tapenade @@ -115,10 +118,12 @@ stages: REPO_NAME: ${{ parameters.REPO_NAME }} TIMEOUT: ${{ parameters.TIMEOUT_STYLE }} IGNORE_STYLE: ${{ parameters.IGNORE_STYLE }} + BASE_FORMAT_AND_LINT: ${{ parameters.BASE_FORMAT_AND_LINT }} ISORT: ${{ parameters.ISORT }} PYLINT: ${{ parameters.PYLINT }} CLANG_FORMAT: ${{ parameters.CLANG_FORMAT }} FPRETTIFY: ${{ parameters.FPRETTIFY }} + MYPY: ${{ parameters.MYPY }} - stage: Tapenade dependsOn: [] From 7317fef593f8cfd3e5bdab4157b63768ec1a47cf Mon Sep 17 00:00:00 2001 From: Eirikur Jonsson <36180221+eirikurj@users.noreply.github.com> Date: Wed, 26 Nov 2025 14:35:11 +0000 Subject: [PATCH 3/3] installing requirements.txt if present locally (#23) --- azure/azure_style.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure/azure_style.yaml b/azure/azure_style.yaml index 2236365..4d3b737 100644 --- a/azure/azure_style.yaml +++ b/azure/azure_style.yaml @@ -174,6 +174,11 @@ jobs: pip install wheel pip install mypy + # Check if the local repo has a requirements.txt file and install it if present + if [[ -f "requirements.txt" ]]; then + pip install -r requirements.txt + fi + # Run mypy check (should pick up local config from mypy.ini or .mypy.ini if present) mypy