Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/not/executable/bash

if [[ -f "${PWD}/.env" ]]; then
dotenv
fi

PATH_add "${HOME}/.local/share/sentry-devenv/bin"

if ! command -v devenv >/dev/null; then
echo "install devenv: https://github.com/getsentry/devenv#install"
return 1
fi

PATH_add "${PWD}/.devenv/bin"

export VIRTUAL_ENV="${PWD}/.venv"
PATH_add "${PWD}/.venv/bin"
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,17 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6
with:
python-version: 3.8
version: '0.8.2'
# we just cache the venv-dir directly in action-setup-venv
enable-cache: false

- name: Setup python dependencies
run: pip install --upgrade mkdocs mkdocs-material pygments
- uses: getsentry/action-setup-venv@3a832a9604b3e1a4202ae559248f26867b467cc7 # v2.1.1
with:
python-version: 3.11.11
cache-dependency-path: uv.lock
install-cmd: uv sync --frozen --only-dev --active

- name: Build Docs
run: mkdocs build
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6
with:
python-version: 3.8
version: '0.8.2'
# we just cache the venv-dir directly in action-setup-venv
enable-cache: false

- name: Setup python dependencies
run: pip install --upgrade mkdocs mkdocs-material pygments
- uses: getsentry/action-setup-venv@3a832a9604b3e1a4202ae559248f26867b467cc7 # v2.1.1
with:
python-version: 3.11.11
cache-dependency-path: uv.lock
install-cmd: uv sync --frozen --only-dev --active

- name: Build Docs
run: |
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: pre-commit

on:
push:
branches:
- master
pull_request:

# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

defaults:
run:
# the default default is:
# bash --noprofile --norc -eo pipefail {0}
shell: bash --noprofile --norc -eo pipefail -ux {0}

jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Get changed files
id: changes
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
with:
list-files: json
filters: |
all:
- added|modified: '**/*'

- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4

- uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6
with:
version: '0.8.2'

- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/pre-commit
key: cache-epoch-1|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml', 'uv.lock') }}

- name: Install pre-commit
run: |
uv export --only-dev --no-hashes --no-annotate --no-header | grep 'pre-commit' | sed -E 's/ ;.*//' | xargs uv pip install
pre-commit install-hooks

- name: Run pre-commit
run: |
jq '.[]' --raw-output <<< '${{steps.changes.outputs.all_files}}' |
xargs pre-commit run --files
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: end-of-file-fixer
exclude_types: [svg]
- id: trailing-whitespace
exclude_types: [svg]
- id: check-added-large-files
args: ['--maxkb=1024']
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.11
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SHELL = /bin/bash
export SYMBOLICATOR_PYTHON_VERSION := python3

all: check test
.PHONY: all
Expand Down Expand Up @@ -33,17 +32,19 @@ test:

# Documentation

docs: .venv/bin/python
.venv/bin/pip install -U mkdocs mkdocs-material pygments
docs: venv
.venv/bin/mkdocs build
touch site/.nojekyll
.PHONY: docs

docserver: .venv/bin/python
.venv/bin/pip install -U mkdocs mkdocs-material pygments
docserver: venv
.venv/bin/mkdocs serve
.PHONY: doc

venv:
devenv sync
.PHONY: venv

# Style checking

style:
Expand All @@ -65,12 +66,6 @@ format:
cargo +stable fmt
.PHONY: format-rust

# Dependencies (currently needed for docs)

.venv/bin/python: Makefile
rm -rf .venv
$$SYMBOLICATOR_PYTHON_VERSION -m venv .venv

# Build GoCD pipelines

gocd:
Expand Down
14 changes: 14 additions & 0 deletions devenv/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[devenv]
minimum_version = 1.22.1

[uv]
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-apple-darwin.tar.gz
darwin_arm64_sha256 = 954d24634d5f37fa26c7af75eb79893d11623fc81b4de4b82d60d1ade4bfca22
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-apple-darwin.tar.gz
darwin_x86_64_sha256 = ae755df53c8c2c1f3dfbee6e3d2e00be0dfbc9c9b4bdffdb040b96f43678b7ce
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-unknown-linux-gnu.tar.gz
linux_arm64_sha256 = 27da35ef54e9131c2e305de67dd59a07c19257882c6b1f3cf4d8d5fbb8eaf4ca
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-unknown-linux-gnu.tar.gz
linux_x86_64_sha256 = 6dcb28a541868a455aefb2e8d4a1283dd6bf888605a2db710f0530cec888b0ad
# used for autoupdate
version = 0.8.2
24 changes: 24 additions & 0 deletions devenv/sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from devenv import constants
from devenv.lib import config, proc, uv


def main(context: dict[str, str]) -> int:
reporoot = context["reporoot"]
cfg = config.get_repo(reporoot)

uv.install(
cfg["uv"]["version"],
cfg["uv"][constants.SYSTEM_MACHINE],
cfg["uv"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)

print("syncing .venv ...")
proc.run(
(f"{reporoot}/.devenv/bin/uv", "sync", "--frozen", "--quiet", "--active"),
)

print("installing pre-commit hooks ...")
proc.run((f"{reporoot}/.venv/bin/pre-commit", "install", "--install-hooks"))

return 0
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[project]
name = "symbolicator"
# we only have this here to make uv happy
# we use uv for dependency management, not packaging
version = "0.0.0"

[dependency-groups]
dev = [
"devservices>=1.2.1",
"mkdocs>=1.6.1",
"mkdocs-material>=9.6.17",
"pre-commit>=4.3.0",
"pygments>=2.19.2",
]

[tool.uv]
environments = ["sys_platform == 'darwin' or sys_platform == 'linux'"]

# TODO pypi deps
#[[tool.uv.index]]
#url = "https://pypi.devinfra.sentry.io/simple"
#default = true
Loading
Loading