diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..504b0fc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: Docker build + +on: + workflow_call: + workflow_dispatch: + +permissions: + contents: read + +jobs: + lambda-build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 + + - name: Test Refiner Lambda build + uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 + with: + context: . + file: docker/lambda.Dockerfile + push: false + platforms: linux/amd64 + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..295009d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,40 @@ +name: Run linter & format check + +on: + workflow_call: + workflow_dispatch: + +permissions: + contents: read + +jobs: + ruff: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: "Set up Python" + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version-file: "pyproject.toml" + + - name: Install uv + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 + with: + version-file: "pyproject.toml" + enable-cache: true + + - name: Install the project + run: uv sync --all-packages --locked --all-extras --dev + + - name: Run ruff linter + shell: bash + run: | + uv run ruff check + + - name: Run ruff format check + shell: bash + run: | + uv run ruff format --check diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 0000000..64f91e7 --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,30 @@ +name: PR Pipeline + +on: + pull_request: + branches: + - "**" + merge_group: + types: + - checks_requested + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + run-linter: + uses: ./.github/workflows/lint.yml + run-tests: + uses: ./.github/workflows/tests.yml + run-type-checking: + uses: ./.github/workflows/typecheck.yml + run-build: + uses: ./.github/workflows/build.yml \ No newline at end of file diff --git a/.github/workflows/pr-security-scan.yml b/.github/workflows/pr-security-scan.yml index ed24b4a..ec2ce0f 100644 --- a/.github/workflows/pr-security-scan.yml +++ b/.github/workflows/pr-security-scan.yml @@ -2,13 +2,12 @@ name: PR Security Scan on: workflow_dispatch: - # TODO: uncomment this trigger block when we want this workflow to run on PRs - # pull_request: - # branches: - # - "**" - # merge_group: - # types: - # - checks_requested + pull_request: + branches: + - "**" + merge_group: + types: + - checks_requested concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 60ba6eb..1c78d09 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,7 +1,8 @@ name: Run tests on: - workflow_dispatch + workflow_call: + workflow_dispatch: permissions: contents: read @@ -12,16 +13,17 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v6 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: "Set up Python" - uses: actions/setup-python@v6 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version-file: "pyproject.toml" - name: Install uv - uses: astral-sh/setup-uv@v7 + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 with: + version-file: "pyproject.toml" enable-cache: true - name: Install the project diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml new file mode 100644 index 0000000..657ea57 --- /dev/null +++ b/.github/workflows/typecheck.yml @@ -0,0 +1,35 @@ +name: Run typechecker + +on: + workflow_call: + workflow_dispatch: + +permissions: + contents: read + +jobs: + ty: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: "Set up Python" + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 + with: + python-version-file: "pyproject.toml" + + - name: Install uv + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 + with: + version-file: "pyproject.toml" + enable-cache: true + + - name: Install the project + run: uv sync --all-packages --locked --all-extras --dev + + - name: Run ty typecheck + shell: bash + run: | + uv run ty check diff --git a/docker/lambda.Dockerfile b/docker/lambda.Dockerfile index 1bade2d..f24fd5a 100644 --- a/docker/lambda.Dockerfile +++ b/docker/lambda.Dockerfile @@ -3,7 +3,7 @@ FROM public.ecr.aws/lambda/python:3.14 AS builder WORKDIR ${LAMBDA_TASK_ROOT} # copy uv binary from uv image -COPY --from=ghcr.io/astral-sh/uv:0.10.9 /uv /bin/uv +COPY --from=ghcr.io/astral-sh/uv:0.11.31 /uv /bin/uv # copy dependency manifests COPY uv.lock pyproject.toml ./ diff --git a/pyproject.toml b/pyproject.toml index 6040309..bb10771 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,9 @@ dev = [ "ty>=0.0.21", ] +[tool.uv] +required-version = ">=0.11.31" + [tool.uv.workspace] members = ["packages/*"]