-
Notifications
You must be signed in to change notification settings - Fork 5
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
15 changed files
with
2,245 additions
and
111 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,80 @@ | ||
################################################################################ | ||
# Base | ||
# - a single-version python slim-bullseye image | ||
# Installs | ||
# - poetry in /opt/poetry | ||
# - adds a user called 'zen' | ||
# Size | ||
# - 300MB | ||
################################################################################ | ||
|
||
ARG PYTHON_VERSION=3.8.15 | ||
ARG DEBIAN_VERSION=bullseye | ||
|
||
FROM python:${PYTHON_VERSION}-slim-${DEBIAN_VERSION} | ||
|
||
ARG NAME=poetry-zen | ||
ARG POETRY_VERSION=1.3.2 | ||
ENV POETRY_HOME=/opt/poetry | ||
ENV PATH="${POETRY_HOME}/bin:${PATH}" | ||
|
||
################################################################################ | ||
# Poetry | ||
################################################################################ | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
# For poetry | ||
curl \ | ||
# For pytrees | ||
graphviz \ | ||
make \ | ||
# For convenience | ||
bash \ | ||
bash-completion \ | ||
ca-certificates \ | ||
git \ | ||
less \ | ||
ssh \ | ||
vim \ | ||
wget \ | ||
&& \ | ||
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${POETRY_VERSION} python3 - && \ | ||
poetry config virtualenvs.create false && \ | ||
poetry completions bash >> ~/.bash_completion | ||
|
||
################################################################################ | ||
# Login Shells for Debugging & Development | ||
################################################################################ | ||
|
||
# In a login shell (below), the PATH env doesn't survive, configure it at ground zero | ||
RUN echo "export PATH=${POETRY_HOME}/bin:${PATH}" >> /etc/profile | ||
ENV TERM xterm-256color | ||
ENTRYPOINT ["/bin/bash", "--login", "-i"] | ||
|
||
################################################################################ | ||
# Development with a user, e.g. for vscode devcontainers | ||
################################################################################ | ||
|
||
ARG USERNAME=zen | ||
ARG USER_UID=1000 | ||
ARG USER_GID=${USER_UID} | ||
|
||
RUN groupadd --gid $USER_GID $USERNAME && \ | ||
useradd --uid $USER_UID --gid $USER_GID -s "/bin/bash" -m $USERNAME && \ | ||
apt-get install -y sudo && \ | ||
echo "${USERNAME} ALL=NOPASSWD: ALL" > /etc/sudoers.d/${USERNAME} && \ | ||
chmod 0440 /etc/sudoers.d/${USERNAME} | ||
RUN echo "export PS1='\[\033[01;36m\](docker)\[\033[00m\] \[\033[01;32m\]\u@${NAME}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >> /home/${USERNAME}/.bashrc && \ | ||
echo "alias ll='ls --color=auto -alFNh'" >> /home/${USERNAME}/.bashrc && \ | ||
echo "alias ls='ls --color=auto -Nh'" >> /home/${USERNAME}/.bashrc && \ | ||
poetry completions bash >> /home/${USERNAME}/.bash_completion | ||
|
||
# touch /home/${USERNAME}/.bash_completion && chown ${USERNAME}:${USERNAME} /home/${USERNAME}/.bash_completion | ||
|
||
################################################################################ | ||
# Debugging with root | ||
################################################################################ | ||
|
||
RUN echo "export PS1='\[\033[01;36m\](docker)\[\033[00m\] \[\033[01;32m\]\u@${NAME}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '" >> ${HOME}/.bashrc && \ | ||
echo "alias ll='ls --color=auto -alFNh'" >> ${HOME}/.bashrc && \ | ||
echo "alias ls='ls --color=auto -Nh'" >> ${HOME}/.bashrc |
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,20 @@ | ||
# Development Environment | ||
|
||
These VSCode devcontainers setup multiple environments for testing against | ||
different python versins. | ||
|
||
## Setup | ||
|
||
``` | ||
$ git clone [email protected]:splintered-reality/py_trees.git | ||
$ code ./py_trees | ||
``` | ||
|
||
## VSCode DevContainer | ||
|
||
At this point you can either "Re-open project in container" to develop against | ||
the default python version. | ||
|
||
Alternatively "Open Folder in Container" and point it at one of the | ||
`py<MAJOR><MINOR>` subfolders in this directory to develop against a different | ||
python version. |
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,33 @@ | ||
{ | ||
"name": "headless-py310", | ||
|
||
"build": { | ||
"dockerfile": "../Dockerfile", | ||
"args": { | ||
"NAME": "py_trees-310", | ||
"POETRY_VERSION": "1.8.4", | ||
"PYTHON_VERSION": "3.10.15", | ||
"DEBIAN_VERSION": "bookworm" | ||
} | ||
}, | ||
"containerEnv": { | ||
"POETRY_HTTP_BASIC_PYPI_USERNAME": "${localEnv:POETRY_HTTP_BASIC_PYPI_USERNAME}", | ||
"POETRY_HTTP_BASIC_PYPI_PASSWORD": "${localEnv:POETRY_HTTP_BASIC_PYPI_PASSWORD}" | ||
}, | ||
"remoteUser": "zen", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"bierner.github-markdown-preview", | ||
"bungcip.better-toml", | ||
"streetsidesoftware.code-spell-checker", | ||
"lextudio.restructuredtext", | ||
"ms-python.python", | ||
"omnilib.ufmt" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "poetry install", | ||
// "workspaceMount": "source=${localWorkspaceFolder}/../..,target=/workspaces,type=bind", | ||
// "workspaceFolder": "/workspaces" | ||
} |
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,38 @@ | ||
{ | ||
"name": "headless-py38", | ||
|
||
"build": { | ||
"dockerfile": "../Dockerfile", | ||
"args": { | ||
"NAME": "streamlit_parameters", | ||
"POETRY_VERSION": "1.8.4", | ||
"PYTHON_VERSION": "3.8.16", | ||
"DEBIAN_VERSION": "bookworm" | ||
}, | ||
"context": ".." | ||
}, | ||
"containerEnv": { | ||
"POETRY_HTTP_BASIC_PYPI_USERNAME": "${localEnv:POETRY_HTTP_BASIC_PYPI_USERNAME}", | ||
"POETRY_HTTP_BASIC_PYPI_PASSWORD": "${localEnv:POETRY_HTTP_BASIC_PYPI_PASSWORD}" | ||
}, | ||
"remoteUser": "zen", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"bierner.github-markdown-preview", | ||
"bierner.markdown-preview-github-styles", | ||
"bungcip.better-toml", | ||
"eamodio.gitlens", | ||
"ms-python.python", | ||
"omnilib.ufmt", | ||
"redhat.vscode-yaml", | ||
"streetsidesoftware.code-spell-checker", | ||
"tht13.rst-vscode" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "poetry install", | ||
// Breaks codespaces | ||
// "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces,type=bind", | ||
// "workspaceFolder": "/workspaces" | ||
} |
This file was deleted.
Oops, something went wrong.
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,64 @@ | ||
name: pre-merge | ||
|
||
on: | ||
push: | ||
branches: [ devel ] | ||
pull_request: | ||
branches: [ devel ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.10"] | ||
include: | ||
- python-version: "3.8" | ||
python-py-version: "py38" | ||
- python-version: "3.10" | ||
python-py-version: "py310" | ||
container: ghcr.io/${{ github.repository }}:${{ matrix.python-py-version }}-poetry-bullseye | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Python Version | ||
run: python3 --version | ||
- name: Poetry Venv Dir | ||
run: | | ||
echo "VENV_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV | ||
- name: Restore the Cache | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.VENV_DIR }} | ||
# bump the suffix if you need to force-refresh the cache | ||
key: streamlit-parameters-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock', '**/tox.ini') }}-1 | ||
|
||
# Install all deps, sans the project (--no-root) | ||
- name: Poetry - Install Dependencies | ||
run: poetry install --no-interaction --no-root | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
|
||
# Project is installed separately to avoid always invalidating the cache | ||
- name: Poetry - Install Project | ||
run: poetry install --no-interaction | ||
- name: Tox - Tests [py38] | ||
# fast this time around since the last step did the installation, venv.bash will only check here | ||
run: | | ||
source ./venv.bash | ||
tox -e py38 | ||
- name: Tox - Tests | ||
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e ${{ matrix.python-py-version }} | ||
|
||
- name: Tox - Formatters, Linters | ||
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e check | ||
|
||
- name: Froody | ||
run: echo I am froody, you should be too |
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,75 @@ | ||
name: push-poetry-image | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
POETRY_VERSION: 1.8.4 | ||
PYTHON_PRIMARY_VERSION: 3.10.15 | ||
PYTHON_PRIMARY_TAG: py310 | ||
PYTHON_SECONDARY_VERSION: 3.8.16 | ||
PYTHON_SECONDARY_TAG: py38 | ||
DEBIAN_VERSION: bullseye | ||
|
||
on: | ||
push: | ||
paths: | ||
- .devcontainer/Dockerfile | ||
branches: | ||
- devel | ||
workflow_dispatch: | ||
|
||
jobs: | ||
push-poetry-image: | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Login to GCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Echo | ||
run: | | ||
echo "USER: ${{ github.actor }}" | ||
echo "REPOSITORY: ${{ github.repository }}" | ||
echo "POETRY_VERSION: ${POETRY_VERSION}" | ||
echo "PYTHON_PRIMARY_VERSION: ${PYTHON_PRIMARY_VERSION}" | ||
echo "PYTHON_SECONDARY_VERSION: ${PYTHON_SECONDARY_VERSION}" | ||
echo "TAGS: ${{ steps.meta.outputs.tags }}" | ||
echo "LABELS: ${{ steps.meta.outputs.labels }}" | ||
- name: Image - poetry${{ env.POETRY_VERSION }}-python${{ env.PYTHON_PRIMARY_VERSION }} | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: ./.devcontainer/Dockerfile | ||
push: true | ||
build-args: | | ||
PYTHON_VERSION=${{ env.PYTHON_PRIMARY_VERSION }} | ||
POETRY_VERSION=${{ env.POETRY_VERSION }} | ||
DEBIAN_VERSION=${{ env.DEBIAN_VERSION }} | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PYTHON_PRIMARY_TAG }}-poetry-${{ env.DEBIAN_VERSION }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:python${{ env.PYTHON_PRIMARY_VERSION }}-poetry${{ env.POETRY_VERSION }}-${{ env.DEBIAN_VERSION }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
- name: Image - poetry${{ env.POETRY_VERSION }}-python${{ env.PYTHON_SECONDARY_VERSION }} | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: ./.devcontainer/Dockerfile | ||
push: true | ||
build-args: | | ||
PYTHON_VERSION=${{ env.PYTHON_SECONDARY_VERSION }} | ||
POETRY_VERSION=${{ env.POETRY_VERSION }} | ||
DEBIAN_VERSION=${{ env.DEBIAN_VERSION }} | ||
tags: | | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.PYTHON_SECONDARY_TAG }}-poetry-${{ env.DEBIAN_VERSION }} | ||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:python${{ env.PYTHON_SECONDARY_VERSION }}-poetry${{ env.POETRY_VERSION }}-${{ env.DEBIAN_VERSION }} | ||
labels: ${{ steps.meta.outputs.labels }} |
2 changes: 1 addition & 1 deletion
2
.github/workflows/release_archive.yaml → .github/workflows/release-archive.yaml
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,4 +1,4 @@ | ||
name: Release Archive | ||
name: release-archive | ||
|
||
on: | ||
release: | ||
|
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.