diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..26f5e0c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +--- +name: Publish + +on: + push: + tags: + - '*' + +jobs: + publish: + name: "Publish release" + runs-on: "ubuntu-latest" + + steps: + - uses: "actions/checkout@v5" + - uses: "actions/setup-python@v6" + with: + python-version-file: ".python-version" + - name: Install uv + uses: astral-sh/setup-uv@v7 + - name: "Install dependencies" + run: make install + - name: "Build package & docs" + run: | + make build + - name: "Publish" + run: | + make publish + env: + UV_PUBLISH_USERNAME: __token__ + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ba617b2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +--- +name: Test Suite + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + tests: + name: "Python ${{ matrix.python-version }}" + runs-on: "ubuntu-latest" + + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + + steps: + - uses: "actions/checkout@v5" + - uses: "actions/setup-python@v6" + with: + python-version: "${{ matrix.python-version }}" + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + python-version: "${{ matrix.python-version }}" + - name: "Install dependencies" + run: make install + - name: "Run linting checks" + run: make lint + - name: "Run tests" + run: make test + - name: "Upload Coverage" + uses: codecov/codecov-action@v5 + with: + files: coverage.xml \ No newline at end of file diff --git a/.gitignore b/.gitignore index 39e8f73..bef758c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ .pytest_cache/ .ruff_cache/ .coverage +coverage.xml __pycache__/ *.py[cod] \ No newline at end of file diff --git a/Makefile b/Makefile index 4e5da96..b87d82e 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ .DEFAULT_GOAL := all +.PHONY: install +install: + uv sync + .PHONY: format format: ruff check --fix . @@ -12,7 +16,16 @@ lint: .PHONY: test test: - pytest --cov=aws_lambda_opentelemetry tests -vvv + pytest --cov-report term --cov-report xml:coverage.xml --cov=aws_lambda_opentelemetry tests -vvv + +.PHONY: build +build: + uv build + + +.PHONY: publish +publish: + uv publish .PHONY: all -all: format lint test \ No newline at end of file +all: format lint test build \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index fcd7da3..bd58ee4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,11 @@ +[build-system] +requires = ["uv_build>=0.9.18,<0.10.0"] +build-backend = "uv_build" + +[tool.uv.build-backend] +module-name = "aws_lambda_opentelemetry" +module-root = "" + [project] name = "aws-lambda-opentelemetry" version = "0.0.0" diff --git a/uv.lock b/uv.lock index 71a80b4..3dd0823 100644 --- a/uv.lock +++ b/uv.lock @@ -5,7 +5,7 @@ requires-python = ">=3.10" [[package]] name = "aws-lambda-opentelemetry" version = "0.0.0" -source = { virtual = "." } +source = { editable = "." } dependencies = [ { name = "opentelemetry-api" }, { name = "opentelemetry-sdk" },