diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1cc7ee..f8d9270 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/Dockerfile b/Dockerfile index 77fd620..aaa20b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index f1f6dbe..bdbabc0 100644 --- a/README.md +++ b/README.md @@ -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/ ``` diff --git a/action.yml b/action.yml index d5dbe08..13b2238 100644 --- a/action.yml +++ b/action.yml @@ -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' diff --git a/entrypoint.sh b/entrypoint.sh index 44a450f..6c8bad7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 $*" diff --git a/requirements.txt b/requirements.txt index 4683a98..3877da2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -poetry==0.12.17 +pip==19.3.1