Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ FROM ghcr.io/astral-sh/uv:$UV_VERSION AS uv

FROM mcr.microsoft.com/vscode/devcontainers/base:debian
LABEL maintainer="a5chin <[email protected]>"
LABEL org.opencontainers.image.description="Dev Container for Python development with uv-based dependency management and environment configuration."

ENV PYTHONDONTWRITEBYTECODE=True \
PYTHONUNBUFFERED=True \
UV_LINK_MODE=copy

# hadolint ignore=DL3008
RUN apt-get update \
Expand Down
2 changes: 0 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
},
"containerEnv": {
"DISPLAY": "dummy",
"PYTHONUNBUFFERED": "True",
"UV_LINK_MODE": "copy",
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv"
},
"postCreateCommand": "uv sync --frozen",
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Devcontainer

on:
push:
branches: [main]
paths:
- ".devcontainer/docker-compose.yml"
- ".devcontainer/Dockerfile"
- ".github/workflows/devcontainer.yml"
- ".python-version"

pull_request:
branches: [main]
paths:
- ".devcontainer/docker-compose.yml"
- ".devcontainer/Dockerfile"
- ".github/workflows/devcontainer.yml"
- ".python-version"

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: .devcontainer/Dockerfile

build:
runs-on: ubuntu-latest

needs: lint
if: ${{ success() }}

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: vscode
tags: |
latest

- name: Build Image for VSCode
uses: docker/build-push-action@v6
with:
context: .
file: .devcontainer/Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Compose up vscode
run: docker compose -f '.devcontainer/docker-compose.yml' up -d --build 'vscode'
73 changes: 24 additions & 49 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@ name: Docker
on:
push:
branches: [main]
paths:
- ".github/workflows/docker.yml"
- "**.py"
- ".dockerignore"
- ".python-version"
- "pyproject.toml"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/workflows/docker.yml"
- "**.py"
- ".dockerignore"
- ".python-version"
- "pyproject.toml"
- "uv.lock"

jobs:
lint:
Expand All @@ -19,18 +34,6 @@ jobs:
with:
dockerfile: Dockerfile

lint-devcontainer:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Lint Dockerfile
uses: hadolint/[email protected]
with:
dockerfile: .devcontainer/Dockerfile

build:
runs-on: ubuntu-latest

Expand All @@ -44,48 +47,20 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
context: .
file: Dockerfile
push: false
tags: latest
cache-from: type=gha
cache-to: type=gha,mode=max

build-devcontainer:
runs-on: ubuntu-latest
images: vscode
tags: |
latest

needs: lint-devcontainer
if: ${{ success() }}

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
- name: Build Image
uses: docker/build-push-action@v6
with:
context: .
file: .devcontainer/Dockerfile
file: Dockerfile
push: false
tags: latest
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

compose-devcontainer:
runs-on: ubuntu-latest

needs: build-devcontainer
if: ${{ success() }}

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Compose up vscode
run: docker compose -f '.devcontainer/docker-compose.yml' up -d --build 'vscode'
15 changes: 15 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@ name: Format
on:
push:
branches: [main]
paths:
- ".github/workflows/format.yml"
- "**.py"
- ".python-version"
- "pyproject.toml"
- "ruff.toml"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/workflows/format.yml"
- "**.py"
- ".python-version"
- "pyproject.toml"
- "ruff.toml"
- "uv.lock"

jobs:
ruff:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/gh-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,23 @@ name: Docs
on:
push:
branches: [main]
paths:
- ".github/workflows/gh-deploy.yml"
- "docs"
- ".python-version"
- "mkdocs.yml"
- "pyproject.toml"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/workflows/gh-deploy.yml"
- "docs"
- ".python-version"
- "mkdocs.yml"
- "pyproject.toml"
- "uv.lock"

permissions:
contents: write
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,25 @@ name: Lint
on:
push:
branches: [main]
paths:
- ".github/workflows/lint.yml"
- "**.py"
- ".python-version"
- "pyproject.toml"
- "pyrightconfig.json"
- "ruff.toml"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/workflows/lint.yml"
- "**.py"
- ".python-version"
- "pyproject.toml"
- "pyrightconfig.json"
- "ruff.toml"
- "uv.lock"

jobs:
pyright:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
paths:
- ".devcontainer/Dockerfile"
- ".github/workflows/publish-devcontainer.yml"
- ".python-version"

workflow_dispatch:

env:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,29 @@ name: Test
on:
push:
branches: [main]
paths:
- ".github/workflows/test.yml"
- "**.py"
- ".coveragerc"
- ".env**"
- ".python-version"
- "tests"
- "pyproject.toml"
- "pytest.ini"
- "uv.lock"

pull_request:
branches: [main]
paths:
- ".github/workflows/test.yml"
- "**.py"
- ".coveragerc"
- ".env**"
- ".python-version"
- "tests"
- "pyproject.toml"
- "pytest.ini"
- "uv.lock"

jobs:
coverage:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ WORKDIR /app
COPY --from=uv /uv /uvx /bin/
COPY pyproject.toml uv.lock ./

ENV PYTHONDONTWRITEBYTECODE=True
ENV PYTHONUNBUFFERED=True
ENV UV_LINK_MODE=copy
ENV PYTHONDONTWRITEBYTECODE=True \
PYTHONUNBUFFERED=True \
UV_LINK_MODE=copy

# hadolint ignore=DL3008
RUN apt-get update \
Expand Down