From 98d1bf3e8edcd780ef90cc3a7a5febe208542cf0 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Thu, 2 Mar 2023 17:03:20 -0500 Subject: [PATCH] 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 --- .github/scripts/setup-env.sh | 7 ++++--- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++-------- Makefile | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/scripts/setup-env.sh b/.github/scripts/setup-env.sh index 1f3a42c..96935bc 100755 --- a/.github/scripts/setup-env.sh +++ b/.github/scripts/setup-env.sh @@ -8,7 +8,7 @@ set -e; CI_CACHE=$HOME/.cache; -POETRY_VERSION=1.1.12; +POETRY_VERSION=1.3.2; mkdir --parents "$CI_CACHE"; @@ -27,8 +27,9 @@ poetry run pip --version; poetry install \ --quiet \ - --remove-untracked \ - --no-ansi; + --sync \ + --no-ansi \ + --only ci; poetry env info; poetry run tox --version; diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a880184..ce47e05 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,8 +7,10 @@ on: branches: ["devel"] jobs: Test: + name: Python ${{ matrix.python.version }} runs-on: ubuntu-latest strategy: + fail-fast: true matrix: python: - version: "3.6" @@ -24,12 +26,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Install Python ${{ matrix.python.version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python.version }} + - name: Configure Job Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.cache/pip @@ -39,38 +43,49 @@ jobs: # will be invalidated, and thus all packages will be redownloaded, if the # lockfile is updated key: ${{ runner.os }}-${{ matrix.python.toxenv }}-${{ hashFiles('**/poetry.lock') }} + - name: Configure Path run: echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Configure Environment run: .github/scripts/setup-env.sh + - name: Run Toxenv ${{ matrix.python.toxenv }} run: poetry run tox -e ${{ matrix.python.toxenv }} + Check: runs-on: ubuntu-latest steps: - name: Checkout 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: - python-version: 3.8 + python-version: "3.10" + - name: Configure Job Cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.cache/pip ~/.cache/pypoetry/cache ~/.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 - key: ${{ runner.os }}-py38-${{ hashFiles('**/poetry.lock') }} + key: ${{ runner.os }}-py310-${{ hashFiles('**/poetry.lock') }} + - name: Configure Path run: echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Configure Environment run: .github/scripts/setup-env.sh + - name: Run Static Analysis Checks run: poetry run tox -e static + - name: Run Static Analysis Checks (Tests) run: poetry run tox -e static-tests + - name: Run Security Checks run: poetry run tox -e security diff --git a/Makefile b/Makefile index eb60430..c27782d 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ test: ## Run the project testsuite(s) poetry run tox --recreate --parallel dev: ## Create the local dev environment - poetry install + poetry install --with dev --extras ansible --sync poetry run pre-commit install publish: test wheel source ## Build and upload to pypi (requires $PYPI_API_KEY be set)