This repository has been archived by the owner on Dec 4, 2023. It is now read-only.
forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-36092][INFRA][BUILD][PYTHON] Migrate to GitHub Actions with Co…
…decov from Jenkins ### What changes were proposed in this pull request? This PR proposes to migrate Coverage report from Jenkins to GitHub Actions by setting a dailly cron job. ### Why are the changes needed? For some background, currently PySpark code coverage is being reported in this specific Jenkins job: https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-sbt-hadoop-2.7/ Because of the security issue between [Codecov service](https://app.codecov.io/gh/) and Jenkins machines, we had to work around by manually hosting a coverage site via GitHub pages, see also https://spark-test.github.io/pyspark-coverage-site/ by spark-test account (which is shared to only subset of PMC members). Since we now run the build via GitHub Actions, we can leverage [Codecov plugin](https://github.com/codecov/codecov-action), and remove the workaround we used. ### Does this PR introduce _any_ user-facing change? Virtually no. Coverage site (UI) might change but the information it holds should be virtually the same. ### How was this patch tested? I manually tested: - Scheduled run: https://github.com/HyukjinKwon/spark/actions/runs/1082261484 - Coverage report: https://codecov.io/gh/HyukjinKwon/spark/tree/73f0291a7df1eda98045cd759303aac1c2a9c929/python/pyspark - Run against a PR: https://github.com/HyukjinKwon/spark/actions/runs/1082367175 Closes apache#33591 from HyukjinKwon/SPARK-36092. Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
- Loading branch information
1 parent
72615bc
commit c0d1860
Showing
12 changed files
with
89 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,6 @@ | |
import re | ||
import sys | ||
import subprocess | ||
import glob | ||
import shutil | ||
|
||
from sparktestsupport import SPARK_HOME, USER_HOME, ERROR_CODES | ||
from sparktestsupport.shellutils import exit_from_command_with_retcode, run_cmd, rm_r, which | ||
|
@@ -522,54 +520,6 @@ def run_python_tests(test_modules, parallelism, with_coverage=False): | |
x for x in ["python3.9", "pypy3"] if which(x))) | ||
run_cmd(command) | ||
|
||
if with_coverage: | ||
post_python_tests_results() | ||
|
||
|
||
def post_python_tests_results(): | ||
if "SPARK_TEST_KEY" not in os.environ: | ||
print("[error] 'SPARK_TEST_KEY' environment variable was not set. Unable to post " | ||
"PySpark coverage results.") | ||
sys.exit(1) | ||
spark_test_key = os.environ.get("SPARK_TEST_KEY") | ||
# The steps below upload HTMLs to 'github.com/spark-test/pyspark-coverage-site'. | ||
# 1. Clone PySpark coverage site. | ||
run_cmd([ | ||
"git", | ||
"clone", | ||
"https://spark-test:%[email protected]/spark-test/pyspark-coverage-site.git" % spark_test_key]) | ||
# 2. Remove existing HTMLs. | ||
run_cmd(["rm", "-fr"] + glob.glob("pyspark-coverage-site/*")) | ||
# 3. Copy generated coverage HTMLs. | ||
for f in glob.glob("%s/python/test_coverage/htmlcov/*" % SPARK_HOME): | ||
shutil.copy(f, "pyspark-coverage-site/") | ||
os.chdir("pyspark-coverage-site") | ||
try: | ||
# 4. Check out to a temporary branch. | ||
run_cmd(["git", "symbolic-ref", "HEAD", "refs/heads/latest_branch"]) | ||
# 5. Add all the files. | ||
run_cmd(["git", "add", "-A"]) | ||
# 6. Commit current HTMLs. | ||
run_cmd([ | ||
"git", | ||
"-c", | ||
"user.name='Apache Spark Test Account'", | ||
"-c", | ||
"user.email='[email protected]'", | ||
"commit", | ||
"-am", | ||
"Coverage report at latest commit in Apache Spark"]) | ||
# 7. Delete the old branch. | ||
run_cmd(["git", "branch", "-D", "gh-pages"]) | ||
# 8. Rename the temporary branch to master. | ||
run_cmd(["git", "branch", "-m", "gh-pages"]) | ||
# 9. Finally, force update to our repository. | ||
run_cmd(["git", "push", "-f", "origin", "gh-pages"]) | ||
finally: | ||
os.chdir("..") | ||
# 10. Remove the cloned repository. | ||
shutil.rmtree("pyspark-coverage-site") | ||
|
||
|
||
def run_python_packaging_tests(): | ||
set_title_and_block("Running PySpark packaging tests", "BLOCK_PYSPARK_PIP_TESTS") | ||
|
@@ -815,11 +765,10 @@ def main(): | |
|
||
modules_with_python_tests = [m for m in test_modules if m.python_test_goals] | ||
if modules_with_python_tests: | ||
# We only run PySpark tests with coverage report in one specific job with | ||
# Spark master with SBT in Jenkins. | ||
is_sbt_master_job = "SPARK_MASTER_SBT_HADOOP_2_7" in os.environ | ||
run_python_tests( | ||
modules_with_python_tests, opts.parallelism, with_coverage=is_sbt_master_job) | ||
modules_with_python_tests, | ||
opts.parallelism, | ||
with_coverage=os.environ.get("PYSPARK_CODECOV", "false") == "true") | ||
run_python_packaging_tests() | ||
if any(m.should_run_r_tests for m in test_modules): | ||
run_sparkr_tests() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters