Skip to content
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

feat: migrating off of CircleCI #638

Merged
merged 29 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d0cea7d
saving state of noxfile prior to owlbot.py edits
chalmerlowe Jun 21, 2023
9dd6eb5
minor clean up of leftover artifacts from various experiments
chalmerlowe Jun 21, 2023
e8a5512
linting and black
chalmerlowe Jun 21, 2023
e88a4f9
adds noxfile.py to excludes and removes noxfile edits in owlbot
chalmerlowe Jun 23, 2023
53bd3d8
Adds new kokoro file in presubmit
chalmerlowe Jun 23, 2023
cb6ecfd
removes circle/ci config file
chalmerlowe Jun 27, 2023
eb4714e
Merge branch 'main' into circleci-migration
chalmerlowe Jul 5, 2023
b56f0d7
Merge branch 'main' into circleci-migration
chalmerlowe Jul 6, 2023
0b66029
Merge branch 'main' into circleci-migration
chalmerlowe Jul 7, 2023
9045c1c
Update noxfile.py
chalmerlowe Jul 10, 2023
fcdd477
Update noxfile.py
chalmerlowe Jul 12, 2023
1a5e26a
Update noxfile.py
chalmerlowe Jul 12, 2023
b8d9b2a
remove limit on printing only KOKORO env variables (for testing)
chalmerlowe Jul 12, 2023
5c925c9
updates build.sh with conda environmental variables
chalmerlowe Jul 13, 2023
90b72ff
updates build.sh with conda environmental variables redux
chalmerlowe Jul 13, 2023
9d6bade
removes the ci folder and files related to circle ci
chalmerlowe Jul 13, 2023
da3eaf2
updates env variable to display all vars not just KOKORO
chalmerlowe Jul 13, 2023
eeeff05
removes additional content related to circle ci
chalmerlowe Jul 13, 2023
0db7bde
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 13, 2023
cf2e40a
updates owlbot with build.sh edits
chalmerlowe Jul 13, 2023
a07b46b
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 13, 2023
4bf7389
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 13, 2023
7f3eb4b
Merge branch 'circleci-migration' of https://github.com/googleapis/py…
gcf-owl-bot[bot] Jul 13, 2023
1882651
updates owlbot with build.sh minor tweak
chalmerlowe Jul 13, 2023
4f375a2
revert build.sh
chalmerlowe Jul 13, 2023
3f6d739
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 13, 2023
1a7531a
testing regex change
chalmerlowe Jul 13, 2023
5f6366e
revert build.sh
chalmerlowe Jul 13, 2023
f0423fb
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jul 13, 2023
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
34 changes: 0 additions & 34 deletions .circleci/config.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .kokoro/presubmit/conda_test.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "conda_test"
}
81 changes: 81 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

DEFAULT_PYTHON_VERSION = "3.8"


UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
Expand All @@ -51,6 +52,11 @@
"3.9": [],
}

CONDA_TEST_PYTHON_VERSIONS = [
UNIT_TEST_PYTHON_VERSIONS[0],
UNIT_TEST_PYTHON_VERSIONS[-1],
]

SYSTEM_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
"mock",
Expand Down Expand Up @@ -514,3 +520,78 @@ def prerelease_deps(session):
system_test_folder_path,
*session.posargs,
)


def install_conda_unittest_dependencies(session, standard_deps, conda_forge_packages):
"""Installs packages from conda forge, pypi, and locally."""

# Install from conda-forge and default conda package repos.
session.conda_install(*conda_forge_packages, channel=["defaults", "conda-forge"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

If both default and conda-forge have a package, would we get the version from conda-forge or default? IMO, we should prefer conda-forge since those packages are updated more frequently in general.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. I don't know the answer yet. I will look it up and see if there is a way to identify a preference for source.

Not gonna hold up the PR for this though. If a change is needed, will add to a separate PR.


# Install from pypi for packages not readily available on conda forge.
session.install(
*standard_deps,
)

# Install via pip from the local repo, avoid doing dependency resolution
# via pip, so that we don't override any conda resolved dependencies
session.install("-e", ".", "--no-deps")


@nox.session(python=CONDA_TEST_PYTHON_VERSIONS, venv_backend="mamba")
def conda_test(session):
"""Run test suite in a conda virtual environment.

Installs all test dependencies, then installs this package.
NOTE: Some of these libraries are not readily available on conda-forge
at this time and are thus installed using pip after the base install of
libraries from conda-forge.

We decided that it was more important to prove a base ability to install
using conda than to complicate things with adding a whole nother
set of constraints just for a conda install, so this install does not
attempt to constrain packages (i.e. in a constraints-x.x.txt file)
manually.
"""

standard_deps = (
UNIT_TEST_STANDARD_DEPENDENCIES
+ UNIT_TEST_DEPENDENCIES
+ UNIT_TEST_EXTERNAL_DEPENDENCIES
)

conda_forge_packages = [
"db-dtypes",
"google-api-core",
"google-auth",
"google-auth-oauthlib",
"google-cloud-bigquery",
"google-cloud-bigquery-storage",
"numpy",
"pandas",
"pyarrow",
"pydata-google-auth",
"tqdm",
"protobuf",
]

install_conda_unittest_dependencies(session, standard_deps, conda_forge_packages)

# Provide a list of all installed packages (both from conda forge and pip)
# for troubleshooting purposes.
session.run("conda", "list")
chalmerlowe marked this conversation as resolved.
Show resolved Hide resolved

# Tests are limited to unit tests only, at this time.
session.run(
"py.test",
"--quiet",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=pandas_gbq",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
)
117 changes: 3 additions & 114 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,129 +52,18 @@
excludes=[
# pandas-gbq was originally licensed BSD-3-Clause License
"LICENSE",
# Mulit-processing note isn't relevant, as pandas_gbq is responsible for
# Multi-processing note isn't relevant, as pandas_gbq is responsible for
# creating clients, not the end user.
"docs/multiprocessing.rst",
"README.rst",
"noxfile.py",
"README.rst",
],
)

# ----------------------------------------------------------------------------
# Fixup files
# ----------------------------------------------------------------------------

s.replace(
["noxfile.py"],
r"import pathlib\s+import shutil",
"import pathlib\nimport re\nimport shutil",
)

s.replace(
["noxfile.py"], r"[\"']google[\"']", '"pandas_gbq"',
)


s.replace(
["noxfile.py"], "--cov=google", "--cov=pandas_gbq",
)

# Workaround for https://github.com/googleapis/synthtool/issues/1317
s.replace(
["noxfile.py"], r'extras = "\[\]"', 'extras = ""',
)

s.replace(
["noxfile.py"],
r"@nox.session\(python=DEFAULT_PYTHON_VERSION\)\s+def cover\(session\):",
r"""@nox.session(python=DEFAULT_PYTHON_VERSION)
def prerelease(session):
session.install(
"--extra-index-url",
"https://pypi.fury.io/arrow-nightlies/",
"--prefer-binary",
"--pre",
"--upgrade",
"pyarrow",
)
session.install(
"--extra-index-url",
"https://pypi.anaconda.org/scipy-wheels-nightly/simple",
"--prefer-binary",
"--pre",
"--upgrade",
"pandas",
)
session.install(
"--prefer-binary",
"--pre",
"--upgrade",
"google-api-core",
"google-cloud-bigquery",
"google-cloud-bigquery-storage",
"google-cloud-core",
"google-resumable-media",
# Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642
"grpcio!=1.49.0rc1",
)
session.install(
"freezegun",
"google-cloud-datacatalog",
"google-cloud-storage",
"google-cloud-testutils",
"IPython",
"mock",
"psutil",
"pytest",
"pytest-cov",
)

# Because we test minimum dependency versions on the minimum Python
# version, the first version we test with in the unit tests sessions has a
# constraints file containing all dependencies and extras.
with open(
CURRENT_DIRECTORY
/ "testing"
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
encoding="utf-8",
) as constraints_file:
constraints_text = constraints_file.read()

# Ignore leading whitespace and comment lines.
deps = [
match.group(1)
for match in re.finditer(
r"^\\s*(\\S+)(?===\\S+)", constraints_text, flags=re.MULTILINE
)
]

# We use --no-deps to ensure that pre-release versions aren't overwritten
# by the version ranges in setup.py.
session.install(*deps)
session.install("--no-deps", "-e", ".[all]")

# Print out prerelease package versions.
session.run("python", "-m", "pip", "freeze")

# Run all tests, except a few samples tests which require extra dependencies.
session.run(
"py.test",
"--quiet",
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml",
os.path.join("tests", "unit"),
)
session.run(
"py.test",
"--quiet",
f"--junitxml=prerelease_system_{session.python}_sponge_log.xml",
os.path.join("tests", "system"),
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def cover(session):""",
re.MULTILINE,
)

s.replace(
[".github/header-checker-lint.yml"], '"Google LLC"', '"pandas-gbq Authors"',
)
Expand Down