Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support setting of python and poetry versions #11

Merged
merged 3 commits into from
Nov 19, 2019
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
20 changes: 13 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ on: push

jobs:
ci:
strategy:
matrix:
python_version: [3.5.9, 3.7.0, 3.8.0]
poetry_version: [0.12.17]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build image
run: |
docker build -t actions-poetry .
- name: Print ref
run: |
echo $GITHUB_REF
env
- name: Run image
uses: ./
with:
python_version: ${{ matrix.python_version }}
poetry_version: ${{ matrix.poetry_version }}
release:
needs: ci
runs-on: ubuntu-latest
steps:
- name: Generate release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
37 changes: 32 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
FROM python:3.8.0-alpine3.10
FROM python:slim-buster

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
ENV PYENV_ROOT=/root/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH

COPY entrypoint.sh /
ENTRYPOINT [ "/entrypoint.sh" ]
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
llvm \
make \
python-openssl \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install pyenv, then install python versions
RUN git clone --depth 1 https://github.com/pyenv/pyenv.git $PYENV_ROOT && \
rm -rfv $PYENV_ROOT/.git

COPY requirements.txt entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Install
uses: abatilo/actions-poetry@v1.0.0
uses: abatilo/actions-poetry@v1.1.0
with:
python_version: 3.8.0
poetry_version: 0.12.17
args: install
- name: Run pytest
uses: abatilo/actions-poetry@v1.0.0
uses: abatilo/actions-poetry@v1.1.0
with:
python_version: 3.8.0
poetry_version: 0.12.17
args: run python -m pytest --cov=src --cov-branch --cov-fail-under=100 tests/
```

Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ runs:
branding:
icon: 'truck'
color: 'gray-dark'
inputs:
python_version:
description: 'The version of python to install'
required: true
default: '3.8.0'
poetry_version:
description: 'The version of poetry to install'
required: true
default: '0.12.17'
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
#!/bin/sh
pythonVersion="$INPUT_PYTHON_VERSION"
poetryVersion="$INPUT_POETRY_VERSION"
pyenv install $pythonVersion
pyenv global $pythonVersion
pip install -r /requirements.txt
pip install poetry==$poetryVersion
pyenv rehash

sh -c "poetry $*"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
poetry==0.12.17
pip==19.3.1