Skip to content

Update makefiles to include test targets #831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plone-5/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
*
!zope.conf
!instance/custom.cfg
!instance/develop.cfg
!instance/src
!instance/bin
!build-and-start.sh
!instance/site.cfg
instance/src/ukstats.ccv2.theme
12 changes: 12 additions & 0 deletions plone-5/Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM plone:5.2.7-python38

COPY instance/develop.cfg /plone/instance/
COPY instance/src /plone/instance/src/
RUN \
sed -i '/mysqlclient\|cx-Oracle\|ldap/d' buildout.cfg && \
buildout -c develop.cfg && \
find /data -not -user plone -exec chown plone:plone {} \+ && \
find /plone -not -user plone -exec chown plone:plone {} \+

WORKDIR /plone/instance
CMD ["./bin/test"]
5 changes: 5 additions & 0 deletions plone-5/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ all: build
build:
docker build --build-arg POSTGRES_PASSWORD=$(POSTGRES_PASSWORD) --tag plone .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if its documented but this will only work if the env var POSTGRES_PASSWORD is set, its possible we want toset it, or maybe stick a conditional in to tell people off for not doing so

if [ -z "$POSTGRES_PASSWORD" ]; then
  echo "POSTGRES_PASSWORD is not set"
  exit
fi

something like that...maybe... my bash ain't that great tbh.


.PHONY: test
test:
docker build -t test-plone -f Dockerfile.tests .
docker run -it test-plone

.PHONY: debug
debug: build
docker run -p 8080:8080 plone
11 changes: 8 additions & 3 deletions plone-5/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
# and it doesn't find it without these env vars...
ZLIB_BASE=$(brew --prefix zlib)
export LDFLAGS="-L${ZLIB_BASE}/lib"
export CPPFLAGS="-I${ZLIB_BASE}/include"
export CPPFLAGS="-I${ZLIB_BASE}/include -Wno-error=implicit-function-declaration"
else
sed -i 's|var-dir=/data|var-dir=data|;/RelStorage\|psycopg2\|mysqlclient\|cx-Oracle\|ldap/d' instance/buildout.cfg
fi
Expand All @@ -35,7 +35,12 @@ export $(docker inspect --format='{{join .Config.Env " "}}' plone:${PLONE_VERSIO
# restore my path variable
export PATH=$mypath
Copy link
Contributor

@mikeAdamss mikeAdamss Mar 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not your doing, but I don't think this does anything if it ever did.

ignore that, yes it does


pipenv install requests pip==$PIP setuptools==$SETUPTOOLS zc.buildout==$ZC_BUILDOUT wheel==$WHEEL
sudo pipenv install requests pip==$PIP setuptools==$SETUPTOOLS zc.buildout==$ZC_BUILDOUT wheel==$WHEEL
cd instance
pipenv run buildout -c custom.cfg

if [[ -z "$1" ]]; then
sudo pipenv run buildout -c custom.cfg
else
sudo pipenv run buildout -c $1
fi
cd ..
4 changes: 3 additions & 1 deletion plone-5/plone.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ brew install pipenv zlib libjpeg
# zlib
ZLIB_BASE=$(brew --prefix zlib)
export LDFLAGS="-L${ZLIB_BASE}/lib"
export CPPFLAGS="-I${ZLIB_BASE}/include"
export CPPFLAGS="-I${ZLIB_BASE}/include -Wno-error=implicit-function-declaration"
```

## 2. Bootstrap
Docker is used to extract a baseline `buildout` config. Plone can be run in a Pipenv locally.

Finally, run `./bootstrap.sh` to create a local, virtualenv (Pipenv) separate environment with all the right dependencies fetched by `buildout` and placed into the `buildout-cache` directory.

Optionally, running `./bootstrap.sh <filename>` with the name of another .cfg file will force the buildout stage to use that configuration. It uses `custom.cfg` by default, but `./bootstrap.sh develop.cfg` may be necessary to generate test scripts.

## 3. Launch

Once buildout completes, the `instance` directory will contain all necessary dependencies and scripts used to launch Plone. This can be launched directly:
Expand Down
16 changes: 11 additions & 5 deletions volto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,27 @@ SHELL=bash
RAZZLE_PATH=http://localhost:8080/climate-change

.PHONY: all
all: test build
all: audit test build

.PHONY: build
build:
yarn build

.PHONY: install
build:
install:
yarn develop && yarn install

# yarn audit will always return a non-zero exit code if
# any vulnerabilities are found regardless of severity
.PHONY: audit
audit: install
yarn audit --summary

.PHONY: test
test:
yarn test
test: install
yarn test --watchAll=false

.PHONY: debug
debug:
yarn run clean
RAZZLE_DEV_PROXY_API_PATH=$(RAZZLE_PATH) yarn start:dev
RAZZLE_DEV_PROXY_API_PATH=$(RAZZLE_PATH) yarn start:dev