Browse Source

Pull in the latest template changes

pull/1327/head
Ross McFarland 1 month ago
parent
commit
056185d569
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
7 changed files with 42 additions and 48 deletions
  1. +4
    -0
      .changelog/b146c7e36d3142c7ad5cac2518c43178.md
  2. +4
    -4
      .git_hooks_pre-commit
  3. +1
    -1
      script/bootstrap
  4. +6
    -11
      script/cibuild
  5. +5
    -1
      script/cibuild-setup-py
  6. +18
    -13
      script/coverage
  7. +4
    -18
      script/release

+ 4
- 0
.changelog/b146c7e36d3142c7ad5cac2518c43178.md View File

@ -0,0 +1,4 @@
---
type: none
---
Pull in the latest template changes

+ 4
- 4
.git_hooks_pre-commit View File

@ -5,10 +5,10 @@ SCRIPT_PATH="$( dirname -- "$( readlink -f -- "${0}"; )"; )/script"
# Activate OctoDNS Python venv
source "${SCRIPT_PATH}/common.sh"
./script/changelog check
./script/lint
./script/format --check --quiet || (
"${SCRIPT_PATH}/changelog" check
"${SCRIPT_PATH}/lint"
"${SCRIPT_PATH}/format" --check --quiet || (
echo "Formatting check failed, run ./script/format" &&
exit 1
)
./script/coverage
"${SCRIPT_PATH}/coverage"

+ 1
- 1
script/bootstrap View File

@ -26,7 +26,7 @@ python -m pip install -U 'pip>=10.0.1'
python -m pip install -r requirements.txt
if [ "$ENV" != "production" ]; then
python -m pip install -r requirements-dev.txt -r requirements-docs.txt
python -m pip install -r requirements-dev.txt
fi
if [ -d ".git" ]; then


+ 6
- 11
script/cibuild View File

@ -1,17 +1,12 @@
#!/bin/sh
set -e
cd "$(dirname "$0")/.."
#!/bin/bash
echo "## bootstrap ###################################################################"
script/bootstrap
if [ -z "$VENV_NAME" ]; then
VENV_NAME="env"
fi
. "$VENV_NAME/bin/activate"
# Get current script path
SCRIPT_PATH="$( dirname -- "$( readlink -f -- "${0}"; )"; )"
# Activate OctoDNS Python venv
source "${SCRIPT_PATH}/common.sh"
echo "## environment & versions ######################################################"
python --version
@ -19,7 +14,7 @@ pip --version
echo "## modules: "
pip freeze
echo "## clean up ####################################################################"
find octodns tests -name "*.pyc" -exec rm {} \;
find octodns tests* -name "*.pyc" -exec rm {} \;
rm -f *.pyc
echo "## begin #######################################################################"
# For now it's just lint...


+ 5
- 1
script/cibuild-setup-py View File

@ -18,6 +18,10 @@ python -m build --sdist --wheel
echo "## validate wheel install ###################################################"
pip install dist/*$VERSION*.whl
echo "## validate tests can run against installed code ###############################"
pip install pytest pytest-network
# filename needs to resolved independently as pip requires quoting and doesn't support
# wildcards when installing extra requirements
# (see: https://pip.pypa.io/en/stable/user_guide/#installing-from-wheels)
wheel_file=$(ls dist/*$VERSION*.whl)
pip install "${wheel_file}[test]"
pytest --disable-network
echo "## complete ####################################################################"

+ 18
- 13
script/coverage View File

@ -1,25 +1,30 @@
#!/bin/bash
# Get current script path
SCRIPT_PATH="$( dirname -- "$( readlink -f -- "${0}"; )"; )"
SCRIPT_PATH="$(dirname -- "$(readlink -f -- "${0}")")"
# Activate OctoDNS Python venv
source "${SCRIPT_PATH}/common.sh"
SOURCE_DIR="octodns/"
# Don't allow disabling coverage
grep -r -I --line-number "# pragma: +no.*cover" $SOURCE_DIR && {
echo "Code coverage should not be disabled"
PRAGMA_OUTPUT=$(grep -r -I --line-number "# pragma: \+no.*cover" "$SOURCE_DIR" || echo)
PRAGMA_COUNT=$(echo "$PRAGMA_OUTPUT" | grep -c . || true)
PRAGMA_ALLOWED=2
if [ "$PRAGMA_COUNT" -gt "$PRAGMA_ALLOWED" ]; then
echo "Found $PRAGMA_COUNT instances of 'pragma: no cover' (no more than $PRAGMA_ALLOWED allowed):"
echo "$PRAGMA_OUTPUT"
echo "Code coverage should not be disabled, except for version handling blocks"
exit 1
}
fi
pytest \
--disable-network \
--cov-reset \
--cov=$SOURCE_DIR \
--cov-fail-under=100 \
--cov-report=html \
--cov-report=xml \
--cov-report=term \
--cov-branch \
"$@"
--disable-network \
--cov-reset \
--cov=$SOURCE_DIR \
--cov-fail-under=100 \
--cov-report=html \
--cov-report=xml \
--cov-report=term \
--cov-branch \
"$@"

+ 4
- 18
script/release View File

@ -5,6 +5,8 @@ SCRIPT_PATH="$( dirname -- "$( readlink -f -- "${0}"; )"; )"
# Activate OctoDNS Python venv
source "${SCRIPT_PATH}/common.sh"
set -o pipefail
PYPYRC="$HOME/.pypirc"
if [ ! -e "$PYPYRC" ]; then
cat << EndOfMessage >&2
@ -18,28 +20,12 @@ EndOfMessage
exit 1
fi
# Set so that setup.py will create a public release style version number
export OCTODNS_RELEASE=1
VERSION="$(grep "^__version__" "$ROOT/octodns/__init__.py" | sed -e "s/.* = '//" -e "s/'$//")"
VERSION="$(grep "^__version__" "octodns/__init__.py" | sed -e "s/.* = '//" -e "s/'$//")"
git tag -s "v$VERSION" -m "Release $VERSION"
git push origin "v$VERSION"
echo "Tagged and pushed v$VERSION"
TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX)
git archive --format tar "v$VERSION" | tar xv -C $TMP_DIR
echo "Created clean room $TMP_DIR and archived $VERSION into it"
(cd "$TMP_DIR" && python -m build --sdist --wheel)
if [ ! -d dist ]; then
mkdir dist/
fi
cp $TMP_DIR/dist/*$VERSION.tar.gz $TMP_DIR/dist/*$VERSION*.whl dist/
echo "Copied $TMP_DIR/dists into ./dist"
python -m build --sdist --wheel
twine check dist/*$VERSION.tar.gz dist/*$VERSION*.whl
twine upload dist/*$VERSION.tar.gz dist/*$VERSION*.whl
echo "Uploaded $VERSION"

Loading…
Cancel
Save