-
Notifications
You must be signed in to change notification settings - Fork 88
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
11 changed files
with
4,331 additions
and
634 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 |
---|---|---|
|
@@ -16,34 +16,45 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
python-version: "3.8" | ||
- uses: eifinger/[email protected] | ||
- run: rye config --set-bool behavior.use-uv=true | ||
- run: rye sync --no-lock | ||
version: "0.4.12" | ||
enable-cache: true | ||
|
||
- name: Set up Python 3.12 | ||
run: uv python install 3.12 | ||
|
||
- name: Install dependencies | ||
run: uv sync --python 3.12 --frozen | ||
|
||
- run: make lint | ||
- run: rye run pyright logfire tests | ||
- run: make typecheck | ||
|
||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
python-version: "3.12" | ||
# we use uv directly here since I couldn't get rye to work with UV_EXTRA_INDEX_URL | ||
# see https://github.com/pydantic/logfire/pull/12 | ||
- run: pip install uv | ||
- run: uv pip install --system -r requirements.lock -r requirements-dev.lock | ||
- run: uv pip install --system -U mkdocs-material mkdocstrings-python griffe==0.48.0 | ||
version: "0.4.12" | ||
enable-cache: true | ||
|
||
- name: Set up Python 3.12 | ||
run: uv python install 3.12 | ||
|
||
- run: uv sync --python 3.12 --frozen | ||
- run: uv pip install --upgrade mkdocs-material mkdocstrings-python griffe==0.48.0 | ||
env: | ||
UV_EXTRA_INDEX_URL: ${{ secrets.UV_EXTRA_INDEX_URL }} | ||
- run: | | ||
if [[ -n "${{ github.head_ref }}" && "${{ github.repository }}" != "${{ github.event.pull_request.head.repo.full_name }}" ]]; then | ||
mkdocs build --no-strict | ||
uv run --no-sync mkdocs build --no-strict | ||
else | ||
mkdocs build | ||
uv run --no-sync mkdocs build | ||
fi | ||
test: | ||
|
@@ -57,26 +68,25 @@ jobs: | |
PYTHON: ${{ matrix.python-version }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Ensure requests to production domains fail | ||
if: runner.os == 'Linux' | ||
run: | | ||
echo "203.0.113.0 logfire.dev" | sudo tee -a /etc/hosts | ||
echo "203.0.113.0 logfire-api.pydantic.dev" | sudo tee -a /etc/hosts | ||
echo "203.0.113.0 logfire.pydantic.dev" | sudo tee -a /etc/hosts | ||
- name: set up python | ||
uses: actions/setup-python@v5 | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: eifinger/[email protected] | ||
- name: Pin python-version ${{ matrix.python-version }} | ||
run: rye pin ${{ matrix.python-version }} | ||
- run: rye config --set-bool behavior.use-uv=true | ||
# Update all dependencies to the latest version possible | ||
- run: rye sync --update-all | ||
- run: | | ||
pip install uv | ||
uv pip install "logfire-api @ file://logfire-api" | ||
- run: rye show | ||
version: "0.4.12" | ||
enable-cache: true | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
run: uv python install ${{ matrix.python-version }} | ||
|
||
- run: uv sync --python ${{ matrix.python-version }} --upgrade | ||
|
||
- run: mkdir coverage | ||
- run: make test | ||
env: | ||
|
@@ -93,24 +103,34 @@ jobs: | |
needs: [test] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
python-version: "3.12" | ||
version: "0.4.12" | ||
enable-cache: true | ||
|
||
- name: Set up Python 3.12 | ||
run: uv python install 3.12 | ||
|
||
- name: Create venv | ||
run: uv venv --python 3.12 | ||
|
||
- name: get coverage files | ||
uses: actions/download-artifact@v4 | ||
with: | ||
merge-multiple: true | ||
path: coverage | ||
- run: pip install coverage[toml] | ||
- run: ls -lh coverage | ||
- run: coverage combine coverage | ||
- run: coverage xml | ||
|
||
- run: uv pip install coverage[toml] | ||
- run: uv run coverage combine coverage | ||
- run: uv run coverage xml | ||
- uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml | ||
env_vars: PYTHON | ||
- run: coverage report --fail-under 100 | ||
- run: uv run coverage report --fail-under 100 | ||
|
||
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks | ||
check: | ||
|
@@ -134,27 +154,30 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: set up python | ||
uses: actions/setup-python@v5 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
python-version: "3.12" | ||
version: "0.4.12" | ||
enable-cache: true | ||
|
||
- name: Set up Python 3.12 | ||
run: uv python install 3.12 | ||
|
||
- name: check GITHUB_REF matches package version | ||
uses: samuelcolvin/[email protected] | ||
with: | ||
version_file_path: pyproject.toml | ||
|
||
- uses: eifinger/setup-rye@v2 | ||
- run: rye config --set-bool behavior.use-uv=true | ||
- run: rye build | ||
- run: uv build | ||
|
||
- name: Publish logfire to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
skip-existing: true | ||
|
||
- name: Build logfire-api | ||
run: rye build | ||
run: uv build | ||
working-directory: logfire-api/ | ||
|
||
- name: Publish logfire-api to PyPI | ||
|
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
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
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 |
---|---|---|
@@ -1,59 +1,63 @@ | ||
.DEFAULT_GOAL := all | ||
sources = pydantic tests docs/plugins | ||
|
||
.PHONY: .rye # Check that Rye is installed | ||
.rye: | ||
@rye --version || echo 'Please install Rye: https://rye-up.com/guide/installation/' | ||
.PHONY: .uv # Check that uv is installed | ||
.uv: | ||
@uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/' | ||
|
||
.PHONY: .pre-commit # Check that pre-commit is installed | ||
.pre-commit: | ||
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/' | ||
|
||
.PHONY: install # Install the package, dependencies, and pre-commit for local development | ||
install: .rye .pre-commit | ||
rye show | ||
rye sync --no-lock | ||
install: .uv .pre-commit | ||
uv sync --frozen | ||
uv pip install -e logfire-api | ||
pre-commit install --install-hooks | ||
|
||
.PHONY: format # Format the code | ||
format: | ||
rye format | ||
rye lint --fix | ||
uv run ruff format | ||
uv run ruff check --fix | ||
|
||
.PHONY: lint # Lint the code | ||
lint: | ||
rye lint | ||
rye format --check | ||
uv run ruff check | ||
uv run ruff format --check --diff | ||
|
||
.PHONY: typecheck # Typecheck the code | ||
typecheck: | ||
uv run pyright | ||
|
||
.PHONY: test # Run the tests | ||
test: | ||
rye run coverage run -m pytest | ||
uv run coverage run -m pytest | ||
|
||
.PHONY: generate-stubs # Generate stubs for logfire-api | ||
generate-stubs: | ||
rye run generate-stubs | ||
uv run stubgen -p logfire --include-docstrings --no-analysis | ||
rsync -a out/logfire/ logfire-api/logfire_api/ | ||
|
||
.PHONY: testcov # Run tests and generate a coverage report | ||
testcov: test | ||
@echo "building coverage html" | ||
@rye run coverage html --show-contexts | ||
uv run coverage html --show-contexts | ||
|
||
.PHONY: docs # Build the documentation | ||
docs: | ||
rye run docs | ||
uv run mkdocs build | ||
|
||
# no strict so you can build the docs without insiders packages | ||
.PHONY: docs-serve # Build and serve the documentation | ||
docs-serve: | ||
rye run docs-serve | ||
uv run mkdocs serve --no-strict | ||
|
||
.PHONY: all | ||
all: format lint test | ||
|
||
.PHONY: cf-pages-build # Build the docs for GitHub Pages | ||
cf-pages-build: | ||
python3 -V | ||
python3 -m pip install uv | ||
python3 -m uv pip install --system -r requirements.lock -r requirements-dev.lock | ||
python3 -m uv pip install --system --extra-index-url $(PPPR_URL) -U mkdocs-material mkdocstrings-python griffe==0.48.0 | ||
python3 -m mkdocs build | ||
curl -LsSf https://astral.sh/uv/0.4.12/install.sh | sh | ||
${HOME}/.cargo/bin/uv python install 3.12 | ||
${HOME}/.cargo/bin/uv sync --python 3.12 --frozen | ||
${HOME}/.cargo/bin/uv pip install --upgrade --extra-index-url $(PPPR_URL) mkdocs-material mkdocstrings-python griffe==0.48.0 | ||
${HOME}/.cargo/bin/uv run --no-sync mkdocs build |
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
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
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
Oops, something went wrong.