-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,465 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
common --enable_bzlmod | ||
|
||
common --lockfile_mode=off | ||
|
||
test --test_output=errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Bazel Central Registry | ||
|
||
When the ruleset is released, we want it to be published to the | ||
Bazel Central Registry automatically: | ||
<https://registry.bazel.build> | ||
|
||
This folder contains configuration files to automate the publish step. | ||
See <https://github.com/bazel-contrib/publish-to-bcr/blob/main/templates/README.md> | ||
for authoritative documentation about these files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fixedReleaser: | ||
login: mark-thm | ||
email: 123787712+mark-thm@users.noreply.github.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"homepage": "https://github.com/theoremlp/rules_mypy", | ||
"maintainers": [ | ||
{ | ||
"email": "123787712+mark-thm@users.noreply.github.com", | ||
"github": "mark-thm", | ||
"name": "Mark Elliot" | ||
}, | ||
{ | ||
"email": "bazel-maintainers@theoremlp.com", | ||
"github": "theoremlp", | ||
"name": "Theorem Bazel Maintainers" | ||
} | ||
], | ||
"repository": ["github:theoremlp/rules_myp"], | ||
"versions": [], | ||
"yanked_versions": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
matrix: | ||
platform: | ||
- debian10 | ||
- ubuntu2004 | ||
- macos | ||
- macos_arm64 | ||
bazel: | ||
- 7.x | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
bazel: ${{ bazel }} | ||
build_targets: | ||
- "@rules_mypy//..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"integrity": "**leave this alone**", | ||
"strip_prefix": "{REPO}-{VERSION}", | ||
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# In code review, collapse generated files | ||
docs/*.md linguist-generated=true | ||
|
||
################################# | ||
# Configuration for 'git archive' | ||
# See https://git-scm.com/docs/git-archive#ATTRIBUTES | ||
|
||
# Don't include examples in the distribution artifact, to reduce size. | ||
# You may want to add additional exclusions for folders or files that users don't need. | ||
examples export-ignore |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* @theoremlp/eng | ||
|
||
.github/workflows/*.yml @theoremlp/eng @reviewbot-theorem | ||
uv/private/uv.lock.json @theoremlp/eng @reviewbot-theorem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [":semanticCommitsDisabled"], | ||
"enabledManagers": ["github-actions"], | ||
"timezone": "America/New_York", | ||
"schedule": ["every weekday after 9am before 5pm"], | ||
"branchConcurrentLimit": 10, | ||
"labels": ["automerge"], | ||
"dependencyDashboard": true, | ||
"packageRules": [ | ||
{ | ||
"matchFiles": ["MODULE.bazel"], | ||
"enabled": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"teams": {}, | ||
"reviewers": {}, | ||
"overrides": [ | ||
{ | ||
"description": "Auto-approve automated PRs", | ||
"onlyModifiedByUsers": ["thm-automation[bot]", "renovate-thm[bot]"], | ||
"onlyModifiedFileRegExs": [ | ||
"^.github/workflows/.*", | ||
"^uv/private/uv.lock.json$" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: autorelease | ||
on: | ||
workflow_dispatch: {} | ||
schedule: | ||
# check at 11am every day | ||
- cron: "0 11 * * *" | ||
jobs: | ||
autorelease: | ||
name: autorelease | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
steps: | ||
- name: Get Token | ||
id: app-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.THM_AUTOMATION_APP_ID }} | ||
private-key: ${{ secrets.THM_AUTOMATION_PRIVATE_KEY }} | ||
- name: autorelease | ||
uses: markelliot/autorelease@v2 | ||
with: | ||
github-token: ${{ steps.app-token.outputs.token }} | ||
max-days: 7 | ||
tag-only: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: autosquash | ||
on: | ||
pull_request: | ||
types: | ||
# omit "opened" as labeling happens after opening | ||
# and when we include both the two events end up | ||
# canceling each other's runs. | ||
- reopened | ||
- edited | ||
- labeled | ||
- synchronize | ||
- unlabeled | ||
- ready_for_review | ||
concurrency: | ||
# only one autosquash at a time per PR | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
jobs: | ||
autosquash: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get Token | ||
if: github.event.pull_request.head.repo.full_name == 'theoremlp/rules_mypy' | ||
id: app-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.THM_AUTOMATION_APP_ID }} | ||
private-key: ${{ secrets.THM_AUTOMATION_PRIVATE_KEY }} | ||
- if: github.event.pull_request.head.repo.full_name == 'theoremlp/rules_mypy' | ||
uses: actions/checkout@v4 | ||
- if: github.event.pull_request.head.repo.full_name == 'theoremlp/rules_mypy' | ||
uses: theoremlp/autosquash@v1 | ||
with: | ||
github-token: ${{ steps.app-token.outputs.token }} | ||
pull-request-number: ${{ github.event.pull_request.number }} | ||
squash-commit-title: "${{ github.event.pull_request.title }} (#${{ github.event.pull_request.number }})" | ||
squash-commit-message: "${{ github.event.pull_request.body }}" | ||
do-not-merge-label: "do not merge" | ||
required-label: "automerge" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: reviewbot | ||
on: | ||
pull_request: {} | ||
pull_request_review: {} | ||
jobs: | ||
required-reviewers: | ||
name: reviewbot | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.head.repo.full_name == 'theoremlp/rules_mypy' | ||
steps: | ||
- name: required-reviewers | ||
uses: theoremlp/required-reviews@v2 | ||
with: | ||
github-token: ${{ secrets.REVIEW_TOKEN_PUB }} | ||
post-review: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This file contains Bazel settings to apply on CI only. | ||
# It is referenced with a --bazelrc option in the call to bazel in ci.yaml | ||
|
||
# Debug where options came from | ||
build --announce_rc | ||
|
||
# This directory is configured in GitHub actions to be persisted between runs. | ||
# We do not enable the repository cache to cache downloaded external artifacts | ||
# as these are generally faster to download again than to fetch them from the | ||
# GitHub actions cache. | ||
build --disk_cache=~/.cache/bazel | ||
|
||
# Don't rely on test logs being easily accessible from the test runner, | ||
# though it makes the log noisier. | ||
test --test_output=errors | ||
|
||
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used | ||
test --test_env=XDG_CACHE_HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
test: | ||
uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6 | ||
with: | ||
folders: | | ||
[ | ||
".", | ||
"examples/demo", | ||
] | ||
# we only support Bazel 7, and only with bzlmod enabled | ||
exclude: | | ||
[ | ||
{"bzlmodEnabled": false}, | ||
{"bazelversion": "5.4.0"}, | ||
{"bazelversion": "6.4.0"}, | ||
] | ||
# this ruleset only supports linux and macos | ||
exclude_windows: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Periodic - Update Multitool Versions | ||
on: | ||
workflow_dispatch: {} | ||
schedule: | ||
# run every hour on the 5 between 9am and 5pm (4am and 12pm UTC), M-F | ||
- cron: "5 14-22 * * 1-5" | ||
jobs: | ||
update-requirement: | ||
name: Update Multitool Versions | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
env: | ||
LOCKFILE: uv/private/uv.lock.json | ||
# disable running on anything but main | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
steps: | ||
- name: Get Token | ||
id: app-token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.THM_AUTOMATION_APP_ID }} | ||
private-key: ${{ secrets.THM_AUTOMATION_PRIVATE_KEY }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
- name: Download and Extract Latest Multitool | ||
run: | | ||
latest="$(curl https://api.github.com/repos/theoremlp/multitool/releases/latest | jq -r '.assets[].browser_download_url | select(. | test("x86_64-unknown-linux-gnu.tar.xz$"))')" | ||
wget -O multitool.tar.xz "$latest" | ||
tar --strip-components=1 -xf multitool.tar.xz | ||
- name: Find Updates and Render Lockfile | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: ./multitool --lockfile "$LOCKFILE" update | ||
- name: Commit Changes | ||
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
BRANCH_NAME: "automation/update-multitool-lockfile" | ||
run: | | ||
if [[ -n "$(git diff "$LOCKFILE")" ]] | ||
then | ||
git config --local user.name 'Theorem Automation' | ||
git config --local user.email 'thm-automation[bot]@users.noreply.github.com' | ||
git checkout -b "${BRANCH_NAME}" | ||
git add "$LOCKFILE" | ||
git commit -m "Update Multitool Versions | ||
Updated with [update-multitool](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) by *${GITHUB_ACTOR}* | ||
" | ||
git push origin "${BRANCH_NAME}" -f | ||
gh pr create --fill --label "automerge" >> "$GITHUB_STEP_SUMMARY" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
release: | ||
uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v6 | ||
permissions: | ||
contents: write | ||
with: | ||
release_files: rules_mypy-*.tar.gz | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
# invoked by release workflow | ||
# (via https://github.com/bazel-contrib/.github/blob/master/.github/workflows/release_ruleset.yaml) | ||
|
||
set -o errexit -o nounset -o pipefail | ||
|
||
RULES_NAME="rules_mypy" | ||
TAG="${GITHUB_REF_NAME}" | ||
PREFIX="${RULES_NAME}-${TAG:1}" | ||
ARCHIVE="${RULES_NAME}-${TAG:1}.tar.gz" | ||
|
||
# embed version in MODULE.bazel | ||
perl -pi -e "s/version = \"0\.0\.0\",/version = \"${TAG:1}\",/g" MODULE.bazel | ||
|
||
stash_name=`git stash create`; | ||
git archive --format=tar --prefix=${PREFIX}/ "${stash_name}" | gzip > $ARCHIVE | ||
|
||
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') | ||
|
||
cat << EOF | ||
## Using Bzlmod with Bazel 7 | ||
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`. | ||
2. Add to your \`MODULE.bazel\` file: | ||
\`\`\`starlark | ||
bazel_dep(name = "${RULES_NAME}", version = "${TAG:1}") | ||
\`\`\` | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
bazel-bin/ | ||
bazel-out/ | ||
bazel-testlogs/ | ||
bazel-* | ||
|
||
venv/ | ||
.venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") | ||
|
||
exports_files([ | ||
"MODULE.bazel", | ||
]) | ||
|
||
buildifier( | ||
name = "buildifier.fix", | ||
exclude_patterns = ["./.git/*"], | ||
lint_mode = "fix", | ||
mode = "fix", | ||
visibility = ["//thm/buildtools/fix:__pkg__"], | ||
) | ||
|
||
buildifier_test( | ||
name = "buildifier.test", | ||
exclude_patterns = ["./.git/*"], | ||
lint_mode = "warn", | ||
mode = "diff", | ||
no_sandbox = True, | ||
workspace = "//:MODULE.bazel", | ||
) |
Oops, something went wrong.