Skip to content

Commit

Permalink
Merge pull request #1030 from cderici/build-test-and-issue-template
Browse files Browse the repository at this point in the history
#1030

#### Description

This does two things:

1. Adds a Makefile target called `build-test` that runs the `setup.py sdist` and installs the artifact in a virtual environment and runs a very simple command on it. The purpose of this is to catch the build and runtime dependency problems early on whenever a change is made that'll effect the release down the road (i.e. before it blows up when a new version is released). We add it into a GH action job as well to automatically catch these issues. 
For example, having something like this would've saved us from hitting #1025 on the `3.3.1.0` release, which is the sole reason we had to make a new release https://github.com/juju/python-libjuju/releases/tag/3.3.1.1 afterwards.

2. Updates the bug report template and adds `Please provide a simplified reproducer, and if it's possible please refrain from providing a "clone this repository and run the integration tests to see the problem" type of a reproducer. Thanks!`, which is pretty self-explanatory.

#### QA Steps

Just running the make target to see if it succeeds locally should be sufficient to QA this:

```
make build-test
```

And maybe some manual checking for typos in the template message (b/c user-facing) could help.
  • Loading branch information
jujubot authored Feb 29, 2024
2 parents f0f0ba1 + 8d9ee91 commit fbfa21b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/BugReport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ body:
id: info
attributes:
label: "Reproduce / Test"
description: "Please add valid Python code to reproduce the bug. This will be used as a test for QAing later on."
description: "Please add valid Python code to reproduce the bug. This will be used as a test for QAing later on.
Please provide a simplified reproducer, and if it's possible please refrain from providing a "clone this repository and run the integration tests to see the problem" type of a reproducer. Thanks!"
render: python
validations:
required: true
18 changes: 18 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ jobs:
tox -e lint
./scripts/copyright.sh
build-test:
name: Build test
runs-on: ubuntu-latest
strategy:
matrix:
python:
- "3.10"
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Run build test target
run: |
make build-test
unit-tests:
needs: lint
name: Unit tests
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BIN := .tox/py3/bin
PY := $(BIN)/python3
PIP := $(BIN)/pip3
VERSION := $(shell $(PY) -c "from juju.version import CLIENT_VERSION; print(CLIENT_VERSION)")
VERSION := $(shell python3 -c "from juju.version import CLIENT_VERSION; print(CLIENT_VERSION)")

.PHONY: clean
clean:
Expand Down Expand Up @@ -40,6 +40,16 @@ lint:
docs:
tox -e docs

.PHONY: build-test
build-test:
rm -rf venv
python3 -m venv venv
. venv/bin/activate
python3 setup.py sdist
pip install ./dist/juju-${VERSION}.tar.gz
python3 -c "from juju.controller import Controller"
rm ./dist/juju-${VERSION}.tar.gz

.PHONY: release
release:
git fetch --tags
Expand Down

0 comments on commit fbfa21b

Please sign in to comment.