-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit e07d164
Showing
16 changed files
with
592 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM debian:bullseye-slim as builder | ||
|
||
WORKDIR /opt | ||
|
||
ENV RYE_HOME="/opt/rye" | ||
ENV PATH="$RYE_HOME/shims:$PATH" | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
curl | ||
|
||
SHELL [ "/bin/bash", "-o", "pipefail", "-c" ] | ||
RUN curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash && \ | ||
rye config --set-bool behavior.global-python=true && \ | ||
rye config --set-bool behavior.use-uv=true | ||
|
||
COPY ./.python-version ./pyproject.toml ./requirements* README.md ./ | ||
RUN rye pin "$(cat .python-version)" && \ | ||
rye sync | ||
|
||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye | ||
COPY --from=builder /opt/rye /opt/rye | ||
|
||
ENV RYE_HOME="/opt/rye" | ||
ENV PATH="$RYE_HOME/shims:$PATH" | ||
ENV PYTHONUNBUFFERED True | ||
|
||
RUN rye config --set-bool behavior.global-python=true && \ | ||
rye config --set-bool behavior.use-uv=true | ||
|
||
RUN chown -R vscode $RYE_HOME |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "aws-lambda-python-template", | ||
"build": { | ||
"context": "..", | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {}, | ||
"ghcr.io/dhoeric/features/hadolint:1": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"charliermarsh.ruff", | ||
"codezombiech.gitignore", | ||
"eamodio.gitlens", | ||
"exiasr.hadolint", | ||
"kevinrose.vsc-python-indent", | ||
"mosapride.zenkaku", | ||
"ms-azuretools.vscode-docker", | ||
"ms-python.python", | ||
"njpwerner.autodocstring", | ||
"oderwat.indent-rainbow", | ||
"pkief.material-icon-theme", | ||
"shardulm94.trailing-spaces", | ||
"usernamehw.errorlens", | ||
"yzhang.markdown-all-in-one", | ||
"mhutchie.git-graph", | ||
"GitHub.copilot", | ||
"seatonjiang.gitmoji-vscode" | ||
], | ||
"settings": { | ||
"python.defaultInterpreterPath": "/opt/rye/shims/python", | ||
"[python]": { | ||
"editor.defaultFormatter": "charliermarsh.ruff", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.ruff": "explicit", | ||
"source.organizeImports.ruff": "explicit" | ||
}, | ||
"editor.formatOnSave": true | ||
}, | ||
"files.insertFinalNewline": true, | ||
"files.trimTrailingWhitespace": true, | ||
"terminal.integrated.defaultProfile.linux": "zsh", | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/bin/zsh" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"postStartCommand": "pre-commit install", | ||
"remoteUser": "vscode" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Lint Dockerfile | ||
uses: hadolint/[email protected] | ||
with: | ||
dockerfile: Dockerfile | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
needs: lint | ||
if: ${{ success() }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: false | ||
tags: latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
devcontainer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./.devcontainer/Dockerfile | ||
push: false | ||
tags: latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Ruff | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rye | ||
uses: eifinger/setup-rye@v2 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Set Rye Config | ||
run: | | ||
rye config --set-bool behavior.global-python=true | ||
rye config --set-bool behavior.use-uv=true | ||
- name: Set up Python ${{ matrix.python-version }} | ||
run: | | ||
export PYTHONUNBUFFERED=1 | ||
rye pin ${{ matrix.python-version }} | ||
rye sync | ||
- name: Lint | ||
run: rye run ruff check --output-format=github . | ||
|
||
format: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rye | ||
uses: eifinger/setup-rye@v2 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Set Rye Config | ||
run: | | ||
rye config --set-bool behavior.global-python=true | ||
rye config --set-bool behavior.use-uv=true | ||
- name: Set up Python ${{ matrix.python-version }} | ||
run: | | ||
export PYTHONUNBUFFERED=1 | ||
rye pin ${{ matrix.python-version }} | ||
rye sync | ||
- name: Format | ||
run: rye run ruff format . --check --diff |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
pytest: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rye | ||
uses: eifinger/setup-rye@v2 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Set Rye Config | ||
run: | | ||
rye config --set-bool behavior.global-python=true | ||
rye config --set-bool behavior.use-uv=true | ||
- name: Set up Python ${{ matrix.python-version }} | ||
run: | | ||
export PYTHONUNBUFFERED=1 | ||
rye pin ${{ matrix.python-version }} | ||
rye sync | ||
- name: Run Pytest if directory exists | ||
run: | | ||
if [ -d "./tests/" ]; then | ||
rye run pytest -s | ||
fi |
Oops, something went wrong.