Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into cleanup-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Prescod committed Jan 21, 2023
2 parents b486754 + 2bb633a commit 70edc91
Show file tree
Hide file tree
Showing 31 changed files with 555 additions and 302 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Draft release pull request

on:
workflow_dispatch:
inputs:
version:
description: "Select version bump"
default: "minor"
type: choice
options:
- major
- minor
- patch
- alpha
- beta
- preview
- dev

jobs:
generate-changelog:
name: Create a PR to update version and release notes
runs-on: sfdc-ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Install build tool
run: python -m pip install hatch
- name: Bump version
run: hatch version $VERSION
env:
VERSION: ${{ inputs.version }}
- name: Generate release notes
id: changelog
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PREVIOUS_VERSION=$(gh release view --json tagName --jq .tagName)
NEXT_VERSION="v$(hatch version)"
echo "## $NEXT_VERSION ($(date -I))" > changelog.md
gh api \
--method POST \
-H "Accept: application/vnd.github.v3+json" \
/repos/SFDO-Tooling/CumulusCI/releases/generate-notes \
-f previous_tag_name=$PREVIOUS_VERSION \
-f target_commitish='main' \
-f tag_name=$NEXT_VERSION \
--jq '.body' |
sed -e 's_\(https.*\/\)\([0-9]*\)$_[#\2](\1\2)_' \
-e 's_by @\(.*\) in_by [@\1](https://github.com/\1) in_' >> changelog.md
python utility/update-history.py
- name: Commit changes
run: |
git config user.name github-actions
git config user.email [email protected]
git switch -c "release-$(hatch version)"
git add docs/history.md cumulusci/__about__.py
git commit -m "Update changelog (automated)"
git push origin "release-$(hatch version)"
- name: Commit changes and open PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "Release v$(hatch version)" --fill --label 'auto-pr'
35 changes: 21 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Release cumulusci
name: Publish and release CumulusCI

on:
push:
branches:
- main
paths:
- cumulusci/version.txt
- cumulusci/__about__.py

concurrency: publishing

jobs:
publish-to-pypi:
Expand All @@ -17,20 +19,25 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
- name: Install build tools
run: python -m pip install twine wheel
run: python -m pip install hatch
- name: Build source tarball and binary wheel
run: python setup.py sdist bdist_wheel
run: hatch build -c
- name: Upload to PyPI
run: twine upload dist/*
run: hatch publish
env:
HATCH_INDEX_USER: "__token__"
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
HATCH_INDEX_REPO: "https://test.pypi.org/legacy/"
- name: Create release
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Create tag
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -s -X POST https://api.github.com/repos/$GITHUB_REPOSITORY/git/refs -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d @- << EOF
{"ref": "refs/tags/v$(python setup.py --version)", "sha": "$GITHUB_SHA"}
EOF
# to do:
# - add release notes in github
VERSION="$(hatch version)"
awk '/<!-- latest-start -->/,/<!-- latest-stop -->/' docs/history.md > changelog.md
gh release create "v$VERSION" \
dist/*.whl \
dist/*.tar.gz \
--notes-file changelog.md \
--title $VERSION
5 changes: 2 additions & 3 deletions .github/workflows/release_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ jobs:
- name: Install Python dependencies
run: pip install -r requirements_dev.txt
- name: Install build tools
run: pip install wheel
run: pip install hatch
- name: Test source tarball and binary wheel
run: |
python setup.py sdist bdist_wheel
twine check dist/*
hatch build
- name: Install sfdx
run: |
mkdir sfdx
Expand Down
108 changes: 71 additions & 37 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,49 +1,83 @@
*.py[cod]
.*.swp
.*.swo
venv/
# OS cruft
.DS_Store
cli/help.txt
cli/help.md
cli/help_clean.md
.swp
pybuild
cumulusci.egg-info
build/
dist/

# CumulusCI config and output
.cci
docs/api/
docs/_build/
docs/tasks.rst
docs/flows.rst
.eggs/
.idea/
.tox/
tags
.vscode/
github_release_notes.html
tmp

# Distribution / packaging
*.egg
*.egg-info/
.Python
.installed.cfg
develop-eggs/
dist/
eggs/
env/
lib/
lib64/
parts/
pip-wheel-metadata
sdist/
var/

# Miscellaneous Python cruft
.pdbrc
.pdbrc.py
.python-version
venv/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.pkl

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
.cache/
.coverage
.coverage.*
.python-version
robot/CumulusCI/results/
*.webm
playwright-log.txt
.mypy_cache/
.pytest_cache/
.tox/
cov.xml
htmlcov/
large_cassettes/
.noseids
nosetests.xml
pytestdebug.log
results_junit.xml
test_results.json
log.html
report.html
output.xml

# Robot
*.webm
.pabotsuitenames
geckodriver*.log
pabot_results/
playwright-log.txt
robot/CumulusCI/results/

# Salesforce
**/.sfdx
htmlcov/
.pytest_cache/
pip-wheel-metadata
.mypy_cache/
/docs/_build
.sf

# direnv
.direnv
.envrc

# Editors
*~
.cci
results_junit.xml
test_results.json
pabot_results/
.pabotsuitenames
large_cassettes/
github_release_notes.html
tmp
pytestdebug.log
.*.swp
.*.swo
.vscode/
.idea/
tags
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See docs/contributing.md
1 change: 0 additions & 1 deletion CONTRIBUTING.rst

This file was deleted.

16 changes: 0 additions & 16 deletions MANIFEST.in

This file was deleted.

16 changes: 7 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ slow_tests: vcr # remake VCR cassettes and run other integration tests
cci org scratch_delete pytest
pytest integration_tests/ --org pytest -rs


docs: ## generate Sphinx HTML documentation
$(MAKE) -C docs clean
$(MAKE) -C docs html
Expand All @@ -83,24 +82,23 @@ servedocs: docs ## compile the docs watching for changes
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .

release: clean ## package and upload a release
python setup.py sdist
python setup.py bdist_wheel
twine upload dist/*
hatch build
hatch publish

dist: clean ## builds source and wheel package
python setup.py sdist bdist_wheel
hatch build
ls -l dist

install: clean ## install the package to the active Python's site-packages
python setup.py install
python -m pip install .

tag: clean
git tag -a -m 'version $$(python setup.py --version)' v$$(python setup.py --version)
git tag -a -m 'version $$(hatch version)' v$$(hatch version)
git push --follow-tags

update-deps:
pip-compile --upgrade requirements/prod.in
pip-compile --upgrade requirements/dev.in
pip-compile --upgrade --resolver=backtracking --output-file=requirements/prod.txt pyproject.toml
pip-compile --upgrade --resolver=backtracking --output-file=requirements/dev.txt --all-extras pyproject.toml

dev-install:
python -m pip install --upgrade pip pip-tools setuptools
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ Community](https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePa
_Please note:_ CumulusCI is distributed under an [open source
license](https://github.com/SFDO-Tooling/CumulusCI/blob/main/LICENSE)
and is not covered by the Salesforce Master Subscription Agreement.

<!-- Changelog -->
1 change: 1 addition & 0 deletions cumulusci/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "3.78.0"
5 changes: 3 additions & 2 deletions cumulusci/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

from simple_salesforce import api, bulk

from cumulusci.__about__ import __version__

__import__("pkg_resources").declare_namespace("cumulusci")

__location__ = os.path.dirname(os.path.realpath(__file__))

with open(os.path.join(__location__, "version.txt")) as f:
__version__ = f.read().strip()
__version__ = __version__

if sys.version_info < (3, 8): # pragma: no cover
raise Exception("CumulusCI requires Python 3.8+.")
Expand Down
15 changes: 9 additions & 6 deletions cumulusci/core/keychain/base_project_keychain.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import sarge

from cumulusci.core.config import (
BaseConfig,
ConnectedAppOAuthConfig,
ScratchOrgConfig,
ServiceConfig,
)
from cumulusci.core.config import ConnectedAppOAuthConfig, ServiceConfig
from cumulusci.core.config.base_config import BaseConfig
from cumulusci.core.config.scratch_org_config import ScratchOrgConfig
from cumulusci.core.exceptions import (
CumulusCIException,
CumulusCIUsageError,
Expand Down Expand Up @@ -60,6 +57,8 @@ def _validate_key(self):
def create_scratch_org(self, org_name, config_name, days=None, set_password=True):
"""Adds/Updates a scratch org config to the keychain from a named config"""
scratch_config = self.project_config.lookup(f"orgs__scratch__{config_name}")
if scratch_config is None:
raise OrgNotFound(f"No such org configured: `{config_name}`")
if days is not None:
# Allow override of scratch config's default days
scratch_config["days"] = days
Expand All @@ -86,6 +85,7 @@ def set_org(self, org_config, global_org=False, save=True):
def set_default_org(self, name):
"""set the default org for tasks and flows by name"""
org = self.get_org(name)
assert org is not None
self.unset_default_org()
org.config["default"] = True
org.save()
Expand All @@ -100,6 +100,7 @@ def unset_default_org(self):
"""unset the default orgs for tasks"""
for org in self.list_orgs():
org_config = self.get_org(org)
assert org_config is not None
if org_config.default:
del org_config.config["default"]
org_config.save()
Expand All @@ -114,13 +115,15 @@ def get_default_org(self):
"""retrieve the name and configuration of the default org"""
for org in self.list_orgs():
org_config = self.get_org(org)
assert org_config is not None
if org_config.default:
return org, org_config
return None, None

def get_org(self, name: str):
"""retrieve an org configuration by name key"""
org = self._get_org(name)
assert org
if org.keychain:
assert org.keychain is self
else:
Expand Down
Loading

0 comments on commit 70edc91

Please sign in to comment.