Update repo automation to use new command syntax

Update CI to use Poetry 1.3
Update workflows to match patterns from tox-poetry-installer
Update workflows to use newer job versions
Update makefile and CI to use Poetry 1.3 command syntax
This commit is contained in:
Ethan Paul 2023-03-02 17:03:20 -05:00
parent d11af1658d
commit 98d1bf3e8e
Signed by: enpaul
GPG Key ID: DAF443CA3A2FA6FA
3 changed files with 28 additions and 12 deletions

View File

@ -8,7 +8,7 @@
set -e; set -e;
CI_CACHE=$HOME/.cache; CI_CACHE=$HOME/.cache;
POETRY_VERSION=1.1.12; POETRY_VERSION=1.3.2;
mkdir --parents "$CI_CACHE"; mkdir --parents "$CI_CACHE";
@ -27,8 +27,9 @@ poetry run pip --version;
poetry install \ poetry install \
--quiet \ --quiet \
--remove-untracked \ --sync \
--no-ansi; --no-ansi \
--only ci;
poetry env info; poetry env info;
poetry run tox --version; poetry run tox --version;

View File

@ -7,8 +7,10 @@ on:
branches: ["devel"] branches: ["devel"]
jobs: jobs:
Test: Test:
name: Python ${{ matrix.python.version }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: true
matrix: matrix:
python: python:
- version: "3.6" - version: "3.6"
@ -24,12 +26,14 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Python ${{ matrix.python.version }} - name: Install Python ${{ matrix.python.version }}
uses: actions/setup-python@v1 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python.version }} python-version: ${{ matrix.python.version }}
- name: Configure Job Cache - name: Configure Job Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cache/pip ~/.cache/pip
@ -39,38 +43,49 @@ 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: Configure Path - name: Configure Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure Environment - name: Configure Environment
run: .github/scripts/setup-env.sh run: .github/scripts/setup-env.sh
- name: Run Toxenv ${{ matrix.python.toxenv }} - name: Run Toxenv ${{ matrix.python.toxenv }}
run: poetry run 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: Install Python 3.8
uses: actions/setup-python@v1 - name: Install Python 3.10
uses: actions/setup-python@v4
with: with:
python-version: 3.8 python-version: "3.10"
- name: Configure Job Cache - name: Configure Job Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cache/pip ~/.cache/pip
~/.cache/pypoetry/cache ~/.cache/pypoetry/cache
~/.poetry ~/.poetry
# Hardcoded 'py38' slug here lets this cache piggyback on the 'py38' cache # Hardcoded 'py310' slug here lets this cache piggyback on the 'py310' 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 }}-py310-${{ hashFiles('**/poetry.lock') }}
- name: Configure Path - name: Configure Path
run: echo "$HOME/.local/bin" >> $GITHUB_PATH run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure Environment - name: Configure Environment
run: .github/scripts/setup-env.sh run: .github/scripts/setup-env.sh
- name: Run Static Analysis Checks - name: Run Static Analysis Checks
run: poetry run tox -e static run: poetry run tox -e static
- name: Run Static Analysis Checks (Tests) - name: Run Static Analysis Checks (Tests)
run: poetry run tox -e static-tests run: poetry run tox -e static-tests
- name: Run Security Checks - name: Run Security Checks
run: poetry run tox -e security run: poetry run tox -e security

View File

@ -33,7 +33,7 @@ test: ## Run the project testsuite(s)
poetry run tox --recreate --parallel poetry run tox --recreate --parallel
dev: ## Create the local dev environment dev: ## Create the local dev environment
poetry install poetry install --with dev --extras ansible --sync
poetry run pre-commit install poetry run pre-commit install
publish: test wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set) publish: test wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set)