mirror of
https://github.com/enpaul/tox-poetry-installer.git
synced 2024-10-29 19:47:00 +00:00
Update CI structure
Use new install-poetry script Set path to include poetry directory Use native poetry env management
This commit is contained in:
parent
7f8d27709a
commit
6ac16a5c4d
63
.github/scripts/setup-env.sh
vendored
63
.github/scripts/setup-env.sh
vendored
@ -7,66 +7,29 @@
|
|||||||
|
|
||||||
set -e;
|
set -e;
|
||||||
|
|
||||||
# ##### Prereqs #####
|
|
||||||
#
|
|
||||||
# Set global vars for usage in the script, create the cache directory so we can rely
|
|
||||||
# on that existing, then dump some diagnostic info for later reference.
|
|
||||||
#
|
|
||||||
PATH="$PATH:$HOME/.local/bin"
|
|
||||||
CI_VENV=$HOME/ci;
|
|
||||||
CI_CACHE=$HOME/.cache;
|
CI_CACHE=$HOME/.cache;
|
||||||
CI_CACHE_GET_POETRY="$CI_CACHE/get-poetry.py";
|
POETRY_VERSION=1.1.12;
|
||||||
CI_VENV_PIP="$CI_VENV/bin/pip";
|
|
||||||
CI_VENV_PIP_VERSION=19.3.1;
|
|
||||||
CI_VENV_TOX="$CI_VENV/bin/tox";
|
|
||||||
|
|
||||||
mkdir --parents "$CI_CACHE";
|
mkdir --parents "$CI_CACHE";
|
||||||
|
|
||||||
command -v python;
|
command -v python;
|
||||||
python --version;
|
python --version;
|
||||||
|
|
||||||
# ##### Install Poetry #####
|
curl --location https://install.python-poetry.org \
|
||||||
#
|
--output "$CI_CACHE/install-poetry.py" \
|
||||||
# Download the poetry install script to the cache directory and then install poetry.
|
|
||||||
# After dump the poetry version for later reference.
|
|
||||||
#
|
|
||||||
curl https://install.python-poetry.org \
|
|
||||||
--output "$CI_CACHE_GET_POETRY" \
|
|
||||||
--silent \
|
--silent \
|
||||||
--show-error \
|
--show-error;
|
||||||
--location;
|
python "$CI_CACHE/install-poetry.py" \
|
||||||
python "$CI_CACHE_GET_POETRY" --yes 1>/dev/null;
|
--version "$POETRY_VERSION" \
|
||||||
|
--yes;
|
||||||
poetry --version --no-ansi;
|
poetry --version --no-ansi;
|
||||||
|
poetry run pip --version;
|
||||||
|
|
||||||
# ##### Setup Runtime Venv #####
|
poetry install \
|
||||||
#
|
|
||||||
# Create a virtual environment for poetry to use, upgrade pip in that venv to a pinned
|
|
||||||
# version, then install the current project to the venv.
|
|
||||||
#
|
|
||||||
# Note 1: Poetry, Tox, and this project plugin all use pip under the hood for package
|
|
||||||
# installation. This means that even though we are creating up to eight venvs
|
|
||||||
# during a given CI run they all share the same download cache.
|
|
||||||
# Note 2: The "VIRTUAL_ENV=$CI_VENV" prefix on the poetry commands below sets the venv
|
|
||||||
# that poetry will use for operations. There is no CLI flag for poetry that
|
|
||||||
# directs it to use a given environment, but if it finds itself in an existing
|
|
||||||
# environment it will use it and skip environment creation.
|
|
||||||
#
|
|
||||||
python -m venv "$CI_VENV";
|
|
||||||
|
|
||||||
$CI_VENV_PIP install "pip==$CI_VENV_PIP_VERSION" \
|
|
||||||
--upgrade \
|
|
||||||
--quiet;
|
|
||||||
|
|
||||||
VIRTUAL_ENV=$CI_VENV poetry install \
|
|
||||||
--extras poetry \
|
--extras poetry \
|
||||||
--quiet \
|
--quiet \
|
||||||
--no-ansi \
|
--remove-untracked \
|
||||||
&>/dev/null;
|
--no-ansi;
|
||||||
|
|
||||||
# ##### Print Debug Info #####
|
poetry env info;
|
||||||
#
|
poetry run tox --version;
|
||||||
# Print the pip and tox versions (which will include registered plugins)
|
|
||||||
#
|
|
||||||
$CI_VENV_PIP --version;
|
|
||||||
echo "tox $($CI_VENV_TOX --version)";
|
|
||||||
|
40
.github/workflows/ci.yaml
vendored
40
.github/workflows/ci.yaml
vendored
@ -11,24 +11,24 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python:
|
python:
|
||||||
- version: 3.6
|
- version: "3.6"
|
||||||
toxenv: py36
|
toxenv: py36
|
||||||
- version: 3.7
|
- version: "3.7"
|
||||||
toxenv: py37
|
toxenv: py37
|
||||||
- version: 3.8
|
- version: "3.8"
|
||||||
toxenv: py38
|
toxenv: py38
|
||||||
- version: 3.9
|
- version: "3.9"
|
||||||
toxenv: py39
|
toxenv: py39
|
||||||
- version: "3.10"
|
- version: "3.10"
|
||||||
toxenv: py310
|
toxenv: py310
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Setup:python${{ matrix.python.version }}
|
- name: Install Python ${{ matrix.python.version }}
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python.version }}
|
python-version: ${{ matrix.python.version }}
|
||||||
- name: Setup:cache
|
- name: Configure Job Cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@ -39,20 +39,22 @@ jobs:
|
|||||||
# will be invalidated, and thus all packages will be redownloaded, if the
|
# will be invalidated, and thus all packages will be redownloaded, if the
|
||||||
# lockfile is updated
|
# lockfile is updated
|
||||||
key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }}
|
key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }}
|
||||||
- name: Setup:env
|
- name: Configure Path
|
||||||
|
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
- name: Configure Environment
|
||||||
run: .github/scripts/setup-env.sh
|
run: .github/scripts/setup-env.sh
|
||||||
- name: Run:${{ matrix.python.toxenv }}
|
- name: Run Toxenv ${{ matrix.python.toxenv }}
|
||||||
run: $HOME/ci/bin/tox -e ${{ matrix.python.toxenv }}
|
run: poetry run tox -e ${{ matrix.python.toxenv }}
|
||||||
Check:
|
Check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Setup:python3.8
|
- name: Install Python 3.8
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- name: Setup:cache
|
- name: Configure Job Cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@ -62,11 +64,13 @@ jobs:
|
|||||||
# Hardcoded 'py38' slug here lets this cache piggyback on the 'py38' cache
|
# Hardcoded 'py38' slug here lets this cache piggyback on the 'py38' cache
|
||||||
# that is generated for the tests above
|
# that is generated for the tests above
|
||||||
key: ${{ runner.os }}-py38-${{ hashFiles('**/poetry.lock') }}
|
key: ${{ runner.os }}-py38-${{ hashFiles('**/poetry.lock') }}
|
||||||
- name: Setup:env
|
- name: Configure Path
|
||||||
|
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
- name: Configure Environment
|
||||||
run: .github/scripts/setup-env.sh
|
run: .github/scripts/setup-env.sh
|
||||||
- name: Run:static
|
- name: Run Static Analysis Checks
|
||||||
run: $HOME/ci/bin/tox -e static
|
run: poetry run tox -e static
|
||||||
- name: Run:static-tests
|
- name: Run Static Analysis Checks (Tests)
|
||||||
run: $HOME/ci/bin/tox -e static-tests
|
run: poetry run tox -e static-tests
|
||||||
- name: Run:security
|
- name: Run Security Checks
|
||||||
run: $HOME/ci/bin/tox -e security
|
run: poetry run tox -e security
|
||||||
|
Loading…
Reference in New Issue
Block a user