Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -13,28 +13,28 @@ repos:
# This brings in a portable version of clang-format.
# See also: https://github.com/ssciwr/clang-format-wheel
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
rev: v21.1.2
hooks:
- id: clang-format
types_or: [c++, c]

# CMake linting and formatting
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.15.1
rev: 0.22.3
hooks:
- id: gersemi
name: CMake linting

# Markdown linting
# Config file: .markdownlint.yaml
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
rev: v0.45.0
hooks:
- id: markdownlint

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell

exclude: 'cookiecutter/'
exclude: 'cookiecutter/|infra/'
2 changes: 1 addition & 1 deletion infra/.beman_submodule
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[beman_submodule]
remote=https://github.com/bemanproject/infra.git
commit_hash=3dc3acd501eccaf3c9bd8d93edb1ebf1fa58d8c6
commit_hash=bb58b2a1cc894d58a55bf745be78f5d27029e245
13 changes: 0 additions & 13 deletions infra/.devcontainer/docker_dev_container/devcontainer.json

This file was deleted.

2 changes: 1 addition & 1 deletion infra/.github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @bemanproject/core-reviewers
* @ednolan @neatudarius @rishyak @wusatosi @JeffGarland
2 changes: 2 additions & 0 deletions infra/.github/workflows/beman-submodule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ name: beman-submodule tests

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

Expand Down
97 changes: 0 additions & 97 deletions infra/.github/workflows/build_devcontainer.yml

This file was deleted.

78 changes: 78 additions & 0 deletions infra/.github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Lint Check (pre-commit)

on:
# We have to use pull_request_target here as pull_request does not grant
# enough permission for reviewdog
pull_request_target:
push:
branches:
- main

jobs:
pre-commit-push:
name: Pre-Commit check on Push
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13

# We wish to run pre-commit on all files instead of the changes
# only made in the push commit.
#
# So linting error persists when there's formatting problem.
- uses: pre-commit/[email protected]

pre-commit-pr:
name: Pre-Commit check on PR
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request_target' }}

permissions:
contents: read
checks: write
issues: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# pull_request_target checkout the base of the repo
# We need to checkout the actual pr to lint the changes.
- name: Checkout pr
run: gh pr checkout ${{ github.event.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13

# we only lint on the changed file in PR.
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v45

# See:
# https://github.com/tj-actions/changed-files?tab=readme-ov-file#using-local-git-directory-
- uses: pre-commit/[email protected]
id: run-pre-commit
with:
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}

# Review dog posts the suggested change from pre-commit to the pr.
- name: suggester / pre-commit
uses: reviewdog/action-suggester@v1
if: ${{ failure() && steps.run-pre-commit.conclusion == 'failure' }}
with:
tool_name: pre-commit
level: warning
reviewdog_flags: "-fail-level=error"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

name: 'Beman issue creation workflow'
on:
workflow_call:
workflow_dispatch:
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
# See https://github.com/cli/cli/issues/5075
- uses: actions/checkout@v4
- name: Create issue
run: |
issue_num=$(gh issue list -s open -S "[SCHEDULED-BUILD] infra repo CI job failure" -L 1 --json number | jq 'if length == 0 then -1 else .[0].number end')
body="**CI job failure Report**
- **Time of Failure**: $(date -u '+%B %d, %Y, %H:%M %Z')
- **Commit**: [${{ github.sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
- **Action Run**: [View logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
The scheduled job triggered by cron has failed.
Please investigate the logs and recent changes associated with this commit or rerun the workflow if you believe this is an error."
if [[ $issue_num -eq -1 ]]; then
gh issue create --repo ${{ github.repository }} --title "[SCHEDULED-BUILD] infra repo CI job failure" --body "$body" --assignee ${{ github.actor }}
else
gh issue comment --repo ${{ github.repository }} $issue_num --body "$body"
fi
env:
GH_TOKEN: ${{ github.token }}
27 changes: 27 additions & 0 deletions infra/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,30 @@
*.exe
*.out
*.app

# Python
__pycache__/
.pytest_cache/
*.pyc
*.pyo
*.pyd
*.pyw
*.pyz
*.pywz
*.pyzw
*.pyzwz
*.delete_me

# MAC OS
*.DS_Store

# Editor files
.vscode/
.idea/

# Build directories
infra.egg-info/
beman_tidy.egg-info/
*.egg-info/
build/
dist/
9 changes: 0 additions & 9 deletions infra/.markdownlint.yaml

This file was deleted.

32 changes: 32 additions & 0 deletions infra/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell

# CMake linting and formatting
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.22.3
hooks:
- id: gersemi
name: CMake linting
exclude: ^.*/tests/.*/data/ # Exclude test data directories

# Python linting and formatting
# config file: ruff.toml (not currently present but add if needed)
# https://docs.astral.sh/ruff/configuration/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.2
hooks:
- id: ruff-check
files: ^tools/beman-tidy/
- id: ruff-format
files: ^tools/beman-tidy/
7 changes: 7 additions & 0 deletions infra/.pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- id: beman-tidy
name: "beman-tidy: bemanification your repo"
entry: ./tools/beman-tidy/beman-tidy
language: script
pass_filenames: false
always_run: true
args: [".", "--verbose"]
13 changes: 1 addition & 12 deletions infra/LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -216,15 +217,3 @@ conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.

==============================================================================
Software from third parties included in the Beman Project:
==============================================================================
The Beman Project contains third party software which is under different license
terms. All such code will be identified clearly using at least one of two
mechanisms:
1) It will be in a separate directory tree with its own `LICENSE.txt` or
`LICENSE` file at the top containing the specific license and restrictions
which apply to that software, or
2) It will contain specific license and restriction terms at the top of every
file.
Loading