Skip to content

Commit d44454a

Browse files
committed
init
1 parent 3ce9a13 commit d44454a

File tree

11 files changed

+776
-21
lines changed

11 files changed

+776
-21
lines changed

.envrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/not/executable/bash
2+
3+
if [[ -f "${PWD}/.env" ]]; then
4+
dotenv
5+
fi
6+
7+
PATH_add "${HOME}/.local/share/sentry-devenv/bin"
8+
9+
if ! command -v devenv >/dev/null; then
10+
echo "install devenv: https://github.com/getsentry/devenv#install"
11+
return 1
12+
fi
13+
14+
PATH_add "${PWD}/.devenv/bin"
15+
16+
export VIRTUAL_ENV="${PWD}/.venv"
17+
PATH_add "${PWD}/.venv/bin"

.github/workflows/ci.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,17 @@ jobs:
149149
- name: Checkout sources
150150
uses: actions/checkout@v4
151151

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

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

160164
- name: Build Docs
161165
run: mkdocs build

.github/workflows/docs.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ jobs:
1414
- name: Checkout sources
1515
uses: actions/checkout@v4
1616

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

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

2529
- name: Build Docs
2630
run: |

.github/workflows/pre-commit.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: pre-commit
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
# Cancel in progress workflows on pull_requests.
10+
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
defaults:
16+
run:
17+
# the default default is:
18+
# bash --noprofile --norc -eo pipefail {0}
19+
shell: bash --noprofile --norc -eo pipefail -ux {0}
20+
21+
jobs:
22+
pre-commit:
23+
name: pre-commit
24+
runs-on: ubuntu-24.04
25+
steps:
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
28+
- name: Get changed files
29+
id: changes
30+
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
31+
with:
32+
list-files: json
33+
filters: |
34+
all:
35+
- added|modified: '**/*'
36+
37+
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
38+
39+
- uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6
40+
with:
41+
version: '0.8.2'
42+
43+
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
44+
with:
45+
path: ~/.cache/pre-commit
46+
key: cache-epoch-1|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml', 'uv.lock') }}
47+
48+
- name: Install pre-commit
49+
run: |
50+
uv export --only-dev --no-hashes --no-annotate --no-header | grep 'pre-commit' | sed -E 's/ ;.*//' | xargs uv pip install
51+
pre-commit install-hooks
52+
53+
- name: Run pre-commit
54+
run: |
55+
jq '.[]' --raw-output <<< '${{steps.changes.outputs.all_files}}' |
56+
xargs pre-commit run --files

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-executables-have-shebangs
7+
- id: check-merge-conflict
8+
- id: check-symlinks
9+
- id: end-of-file-fixer
10+
exclude_types: [svg]
11+
- id: trailing-whitespace
12+
exclude_types: [svg]
13+
- id: check-added-large-files
14+
args: ['--maxkb=1024']

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11.11

Makefile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SHELL = /bin/bash
2-
export SYMBOLICATOR_PYTHON_VERSION := python3
32

43
all: check test
54
.PHONY: all
@@ -33,17 +32,19 @@ test:
3332

3433
# Documentation
3534

36-
docs: .venv/bin/python
37-
.venv/bin/pip install -U mkdocs mkdocs-material pygments
35+
docs: venv
3836
.venv/bin/mkdocs build
3937
touch site/.nojekyll
4038
.PHONY: docs
4139

42-
docserver: .venv/bin/python
43-
.venv/bin/pip install -U mkdocs mkdocs-material pygments
40+
docserver: venv
4441
.venv/bin/mkdocs serve
4542
.PHONY: doc
4643

44+
venv:
45+
devenv sync
46+
.PHONY: venv
47+
4748
# Style checking
4849

4950
style:
@@ -65,12 +66,6 @@ format:
6566
cargo +stable fmt
6667
.PHONY: format-rust
6768

68-
# Dependencies (currently needed for docs)
69-
70-
.venv/bin/python: Makefile
71-
rm -rf .venv
72-
$$SYMBOLICATOR_PYTHON_VERSION -m venv .venv
73-
7469
# Build GoCD pipelines
7570

7671
gocd:

devenv/config.ini

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[devenv]
2+
minimum_version = 1.22.1
3+
4+
[uv]
5+
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-apple-darwin.tar.gz
6+
darwin_arm64_sha256 = 954d24634d5f37fa26c7af75eb79893d11623fc81b4de4b82d60d1ade4bfca22
7+
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-apple-darwin.tar.gz
8+
darwin_x86_64_sha256 = ae755df53c8c2c1f3dfbee6e3d2e00be0dfbc9c9b4bdffdb040b96f43678b7ce
9+
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-aarch64-unknown-linux-gnu.tar.gz
10+
linux_arm64_sha256 = 27da35ef54e9131c2e305de67dd59a07c19257882c6b1f3cf4d8d5fbb8eaf4ca
11+
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.8.2/uv-x86_64-unknown-linux-gnu.tar.gz
12+
linux_x86_64_sha256 = 6dcb28a541868a455aefb2e8d4a1283dd6bf888605a2db710f0530cec888b0ad
13+
# used for autoupdate
14+
version = 0.8.2

devenv/sync.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from devenv import constants
2+
from devenv.lib import config, proc, uv
3+
4+
5+
def main(context: dict[str, str]) -> int:
6+
reporoot = context["reporoot"]
7+
cfg = config.get_repo(reporoot)
8+
9+
uv.install(
10+
cfg["uv"]["version"],
11+
cfg["uv"][constants.SYSTEM_MACHINE],
12+
cfg["uv"][f"{constants.SYSTEM_MACHINE}_sha256"],
13+
reporoot,
14+
)
15+
16+
print("syncing .venv ...")
17+
proc.run(
18+
(f"{reporoot}/.devenv/bin/uv", "sync", "--frozen", "--quiet", "--active"),
19+
)
20+
21+
print("installing pre-commit hooks ...")
22+
proc.run((f"{reporoot}/.venv/bin/pre-commit", "install", "--install-hooks"))
23+
24+
return 0

pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[project]
2+
name = "symbolicator"
3+
# we only have this here to make uv happy
4+
# we use uv for dependency management, not packaging
5+
version = "0.0.0"
6+
7+
[dependency-groups]
8+
dev = [
9+
"devservices>=1.2.1",
10+
"mkdocs>=1.6.1",
11+
"mkdocs-material>=9.6.17",
12+
"pre-commit>=4.3.0",
13+
"pygments>=2.19.2",
14+
]
15+
16+
[tool.uv]
17+
environments = ["sys_platform == 'darwin' or sys_platform == 'linux'"]
18+
19+
# TODO pypi deps
20+
#[[tool.uv.index]]
21+
#url = "https://pypi.devinfra.sentry.io/simple"
22+
#default = true

0 commit comments

Comments
 (0)