Skip to content

Commit

Permalink
Merge pull request #3844 from SFDO-Tooling/cumulusci-v4
Browse files Browse the repository at this point in the history
Release v4.0.0
  • Loading branch information
jstvz authored Nov 14, 2024
2 parents 42093d7 + d89b621 commit c731219
Show file tree
Hide file tree
Showing 50 changed files with 2,228 additions and 855 deletions.
55 changes: 30 additions & 25 deletions .github/workflows/feature_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python 3.8
- name: Set up Python 3.11
id: py
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
cache-dependency-path: "requirements/*.txt"
python-version: 3.11
- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true
- name: Install dependencies
run: pip install -r requirements_dev.txt
run: uv sync --group docs
- name: Build Docs
run: make docs
run: |
cd docs
uv run sphinx-build -b html . ./_build
unit_tests:
name: "Unit tests: ${{ matrix.os }}-${{ matrix.python-version }}"
Expand All @@ -41,39 +46,39 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, SFDO-Tooling-Ubuntu, SFDO-Tooling-Windows]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- os: macos-latest
python-version: 3.8
include:
- os: macos-13
python-version: 3.8
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
cache: pip
cache-dependency-path: "requirements/*.txt"
- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true
- name: Install dependencies
run: pip install -r requirements_dev.txt
run: uv sync -p ${{ matrix.python-version }}
- name: Run Pytest
run: pytest --cov-report= --cov=cumulusci
run: uv run pytest --cov-report= --cov=cumulusci

robot_api:
name: "Robot: No browser"
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: pip
cache-dependency-path: "requirements/*.txt"
- name: Install Python dependencies
run: pip install -r requirements_dev.txt
python-version: 3.11
- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true
- name: Install dependencies
run: uv sync -p 3.11
- name: Install sfdx
run: |
mkdir sfdx
Expand All @@ -90,15 +95,15 @@ jobs:
SFDX_HUB_USERNAME: ${{ secrets.SFDX_HUB_USERNAME }}
- name: Run robot tests
run: |
coverage run --append $(which cci) task run robot \
uv run cci task run robot \
--org dev \
-o name "CumulusCI" \
-o suites cumulusci/robotframework/tests \
-o include no-browser
- name: Delete scratch org
if: always()
run: |
cci org scratch_delete dev
uv run cci org scratch_delete dev
- name: Store robot results
if: failure()
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: actions/checkout@main
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
cache: pip
- name: Install build tool
run: python -m pip install hatch
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ jobs:
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: actions/checkout@main
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
cache: pip
- name: Install build tools
run: python -m pip install hatch tomli tomli-w
- name: Pin dependencies
run: python utility/pin_dependencies.py
- name: Build source tarball and binary wheel
run: hatch build -c
- name: Upload to PyPI
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/release_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ jobs:
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
cache: pip
cache-dependency-path: "requirements/*.txt"
cache-dependency-path: "pyproject.toml"
- name: Install build tools
run: pip install hatch
- name: Test source tarball and binary wheel
Expand Down Expand Up @@ -71,14 +71,19 @@ jobs:
concurrency: release
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
cache: pip
cache-dependency-path: "requirements/*.txt"
cache-dependency-path: "pyproject.toml"
- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true
- name: Install Python dependencies
run: pip install -r requirements_dev.txt
run: uv sync
- name: Install sfdx
run: |
mkdir sfdx
Expand All @@ -95,17 +100,17 @@ jobs:
- name: Run ci_feature flow
run: |
cd CumulusCI-Test
coverage run --append --rcfile=../pyproject.toml --source=../cumulusci $(which cci) flow run ci_feature --org scratch --delete-org
uv run cci flow run ci_feature --org scratch --delete-org
- name: Run ci_beta flow
run: |
cd CumulusCI-Test
coverage run --append --rcfile=../pyproject.toml --source=../cumulusci $(which cci) flow run ci_beta --org scratch --delete-org
uv run cci flow run ci_beta --org scratch --delete-org
- name: Run ci_master flow
run: |
cd CumulusCI-Test
coverage run --append --rcfile=../pyproject.toml --source=../cumulusci $(which cci) flow run ci_master --org scratch --delete-org
uv run cci flow run ci_master --org scratch --delete-org
- name: Run release_beta flow
run: |
export SFDX_HUB_KEY="$(echo $SFDX_HUB_KEY_BASE64 | base64 --decode)"
cd CumulusCI-Test
coverage run --append --rcfile=../pyproject.toml --source=../cumulusci $(which cci) flow run release_beta --org packaging
uv run cci flow run release_beta --org packaging
16 changes: 8 additions & 8 deletions .github/workflows/slow_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
cache: pip
cache-dependency-path: "requirements/*.txt"
cache-dependency-path: "pyproject.toml"
- name: Install Python dependencies
run: |
python -m pip install -U pip
pip install -r requirements_dev.txt
pip install .[test]
- name: Install sfdx
run: |
mkdir sfdx
Expand Down Expand Up @@ -73,14 +73,14 @@ jobs:
# org-shape: "prerelease"
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.11
cache: pip
cache-dependency-path: "requirements/*.txt"
cache-dependency-path: "pyproject.toml"
- name: Install Python dependencies
run: pip install -r requirements_dev.txt
run: pip install .[test]
- name: Install sfdx
run: |
mkdir sfdx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ jobs:
update_python_dependencies:
uses: SFDO-Tooling/.github/.github/workflows/update_python_dependencies.yml@main
with:
python-version: 3.8
python-version: 3.11
2 changes: 1 addition & 1 deletion cumulusci/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.93.0"
__version__ = "4.0.0"
1 change: 0 additions & 1 deletion cumulusci/cli/tests/test_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ def test_org_list(self, cli_tbl):
],
title="Connected Orgs",
)

assert scratch_table_call in cli_tbl.call_args_list
assert connected_table_call in cli_tbl.call_args_list
runtime.keychain.cleanup_org_cache_dirs.assert_called_once()
Expand Down
31 changes: 15 additions & 16 deletions cumulusci/core/config/scratch_org_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def days_alive(self) -> Optional[int]:
return delta.days + 1

def create_org(self) -> None:
"""Uses sfdx force:org:create to create the org"""
"""Uses sf org create scratch to create the org"""
if not self.config_file:
raise ScratchOrgException(
f"Scratch org config {self.name} is missing a config_file"
Expand All @@ -72,7 +72,7 @@ def create_org(self) -> None:
args: List[str] = self._build_org_create_args()
extra_args = os.environ.get("SFDX_ORG_CREATE_ARGS", "")
p: sarge.Command = sfdx(
f"force:org:create --json {extra_args}",
f"org create scratch --json {extra_args}",
args=args,
username=None,
log_note="Creating scratch org",
Expand Down Expand Up @@ -139,33 +139,32 @@ def _build_org_create_args(self) -> List[str]:
args = ["-f", self.config_file, "-w", "120"]
devhub_username: Optional[str] = self._choose_devhub_username()
if devhub_username:
args += ["--targetdevhubusername", devhub_username]
args += ["--target-dev-hub", devhub_username]
if not self.namespaced:
args += ["-n"]
args += ["--no-namespace"]
if self.noancestors:
args += ["--noancestors"]
args += ["--no-ancestors"]
if self.days:
args += ["--durationdays", str(self.days)]
args += ["--duration-days", str(self.days)]
if self.release:
args += [f"release={self.release}"]
args += [f"--release={self.release}"]
if self.sfdx_alias:
args += ["-a", self.sfdx_alias]
with open(self.config_file, "r") as org_def:
org_def_data = json.load(org_def)
org_def_has_email = "adminEmail" in org_def_data
if self.email_address and not org_def_has_email:
args += [f"adminEmail={self.email_address}"]
args += [f"--admin-email={self.email_address}"]
if self.default:
args += ["-s"]
if instance := self.instance or os.environ.get("SFDX_SIGNUP_INSTANCE"):
args += [f"instance={instance}"]
args += ["--set-default"]

return args

def _choose_devhub_username(self) -> Optional[str]:
"""Determine which devhub username to specify when calling sfdx, if any."""
# If a devhub was specified via `cci org scratch`, use it.
# (This will return None if "devhub" isn't set in the org config,
# in which case sfdx will use its defaultdevhubusername.)
# in which case sf will use its target-dev-hub.)
devhub_username = self.devhub
if not devhub_username and self.keychain is not None:
# Otherwise see if one is configured via the "devhub" service
Expand All @@ -178,7 +177,7 @@ def _choose_devhub_username(self) -> Optional[str]:
return devhub_username

def generate_password(self) -> None:
"""Generates an org password with: sfdx force:user:password:generate.
"""Generates an org password with: sf org generate password.
On a non-zero return code, set the password_failed in our config
and log the output (stdout/stderr) from sfdx."""

Expand All @@ -187,7 +186,7 @@ def generate_password(self) -> None:
return

p: sarge.Command = sfdx(
"force:user:password:generate",
"org generate password",
self.username,
log_note="Generating scratch org user password",
)
Expand All @@ -214,13 +213,13 @@ def can_delete(self) -> bool:
return bool(self.date_created)

def delete_org(self) -> None:
"""Uses sfdx force:org:delete to delete the org"""
"""Uses sf org delete scratch to delete the org"""
if not self.created:
self.logger.info("Skipping org deletion: the scratch org does not exist.")
return

p: sarge.Command = sfdx(
"force:org:delete -p", self.username, "Deleting scratch org"
"org delete scratch -p", self.username, "Deleting scratch org"
)
sfdx_output: List[str] = list(p.stdout_text) + list(p.stderr_text)

Expand Down
14 changes: 7 additions & 7 deletions cumulusci/core/config/sfdx_org_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def sfdx_info(self):
if not self.print_json:
self.logger.info(f"Getting org info from Salesforce CLI for {username}")

# Call force:org:display and parse output to get instance_url and
# Call org display and parse output to get instance_url and
# access_token
p = sfdx("force:org:display --json", self.username)
p = sfdx("org display --json", self.username)

org_info = None
stderr_list = [line.strip() for line in p.stderr_text]
Expand Down Expand Up @@ -166,7 +166,7 @@ def get_access_token(self, **userfields):
else:
username = result[0]["Username"]

p = sfdx(f"force:org:display --targetusername={username} --json")
p = sfdx(f"org display --target-org={username} --json")
if p.returncode:
output = p.stdout_text.read()
try:
Expand All @@ -183,9 +183,9 @@ def get_access_token(self, **userfields):
return info["result"]["accessToken"]

def force_refresh_oauth_token(self):
# Call force:org:display and parse output to get instance_url and
# Call org display and parse output to get instance_url and
# access_token
p = sfdx("force:org:open -r", self.username, log_note="Refreshing OAuth token")
p = sfdx("org open -r", self.username, log_note="Refreshing OAuth token")

stdout_list = [line.strip() for line in p.stdout_text]

Expand All @@ -198,7 +198,7 @@ def force_refresh_oauth_token(self):

# Added a print json argument to check whether it is there or not
def refresh_oauth_token(self, keychain, print_json=False):
"""Use sfdx force:org:describe to refresh token instead of built in OAuth handling"""
"""Use sfdx org display to refresh token instead of built in OAuth handling"""
if hasattr(self, "_sfdx_info"):
# Cache the sfdx_info for 1 hour to avoid unnecessary calls out to sfdx CLI
delta = datetime.datetime.utcnow() - self._sfdx_info_date
Expand All @@ -208,7 +208,7 @@ def refresh_oauth_token(self, keychain, print_json=False):
# Force a token refresh
self.force_refresh_oauth_token()
self.print_json = print_json
# Get org info via sfdx force:org:display
# Get org info via sf org display
self.sfdx_info
# Get additional org info by querying API
self._load_orginfo()
Loading

0 comments on commit c731219

Please sign in to comment.