Loading ci/setup_pages.py +31 −25 Original line number Diff line number Diff line Loading @@ -6,54 +6,60 @@ import sys from get_id_of_last_job_occurence import get_job_id JOBS = [ "complexity-stereo-in-stereo-out", "complexity-ism-in-binaural-out", "complexity-sba-hoa3-in-hoa3-out", "complexity-mc-in-7_1_4-out", "complexity-masa-in-7_1_4-out", "complexity-StereoDmxEVS-stereo-in-mono-out", "coverage-test-on-main-scheduled", ] JOBS_BASOP = [ ] PUBLIC_FOL_MAGIC = "-public" JOBS_FLOAT_REPO = { "complexity-stereo-in-stereo-out": [PUBLIC_FOL_MAGIC], "complexity-ism-in-binaural-out": [PUBLIC_FOL_MAGIC], "complexity-sba-hoa3-in-hoa3-out": [PUBLIC_FOL_MAGIC], "complexity-mc-in-7_1_4-out": [PUBLIC_FOL_MAGIC], "complexity-masa-in-7_1_4-out": [PUBLIC_FOL_MAGIC], "complexity-StereoDmxEVS-stereo-in-mono-out": [PUBLIC_FOL_MAGIC], "coverage-test-on-main-scheduled": ["coverage", "coverage_stv"], } ARTIFACTS = "artifacts.zip" API_URL_BASE = "https://forge.3gpp.org/rep/api/v4/projects/{}/jobs" PUBLIC = "./public" def main(): public_folder = pathlib.Path(PUBLIC) public_folder.mkdir() failed_count = get_artifacts_for_jobs_and_return_num_failed(JOBS, public_folder) failed_count = get_artifacts_for_jobs_and_return_num_failed( JOBS_FLOAT_REPO, public_folder ) if failed_count == len(JOBS): if failed_count == len(JOBS_FLOAT_REPO): sys.exit(1) pathlib.Path("ci/index-pages.html").rename(public_folder.joinpath("index.html")) sys.exit(0) def get_artifacts_for_jobs_and_return_num_failed(jobs: list, public_folder: pathlib.Path) -> int: def get_artifacts_for_jobs_and_return_num_failed( jobs: dict, public_folder: pathlib.Path ) -> int: """ Get specified artifact folders for all jobs given and put them into the public folder. jobs: dictionary with the job names in the keys and a list of the public folders to copy from the artifacts in the values if "-public" is in the list, the actual folder name to copy is the key with "-public" appended public_folder: target folder to copy stuff to """ failed_count = 0 for job in jobs: for job, artifact_folders in jobs.items(): job_id = get_job_id(os.environ["CI_COMMIT_REF_NAME"], job) print(f"{job_id} - {job}") try: curl_for_artifacts(job_id) job_public = job + "-public" if job == "coverage-test-on-main-scheduled": job_public = "coverage" pathlib.Path("coverage_stv").rename( public_folder.joinpath("coverage_stv") ) pathlib.Path(job_public).rename(public_folder.joinpath(job_public)) for fol in artifact_folders: if fol == PUBLIC_FOL_MAGIC: fol = job + fol pathlib.Path(fol).rename(public_folder.joinpath(fol)) except subprocess.CalledProcessError: print(f"Could not get artifacts for {job}") Loading Loading
ci/setup_pages.py +31 −25 Original line number Diff line number Diff line Loading @@ -6,54 +6,60 @@ import sys from get_id_of_last_job_occurence import get_job_id JOBS = [ "complexity-stereo-in-stereo-out", "complexity-ism-in-binaural-out", "complexity-sba-hoa3-in-hoa3-out", "complexity-mc-in-7_1_4-out", "complexity-masa-in-7_1_4-out", "complexity-StereoDmxEVS-stereo-in-mono-out", "coverage-test-on-main-scheduled", ] JOBS_BASOP = [ ] PUBLIC_FOL_MAGIC = "-public" JOBS_FLOAT_REPO = { "complexity-stereo-in-stereo-out": [PUBLIC_FOL_MAGIC], "complexity-ism-in-binaural-out": [PUBLIC_FOL_MAGIC], "complexity-sba-hoa3-in-hoa3-out": [PUBLIC_FOL_MAGIC], "complexity-mc-in-7_1_4-out": [PUBLIC_FOL_MAGIC], "complexity-masa-in-7_1_4-out": [PUBLIC_FOL_MAGIC], "complexity-StereoDmxEVS-stereo-in-mono-out": [PUBLIC_FOL_MAGIC], "coverage-test-on-main-scheduled": ["coverage", "coverage_stv"], } ARTIFACTS = "artifacts.zip" API_URL_BASE = "https://forge.3gpp.org/rep/api/v4/projects/{}/jobs" PUBLIC = "./public" def main(): public_folder = pathlib.Path(PUBLIC) public_folder.mkdir() failed_count = get_artifacts_for_jobs_and_return_num_failed(JOBS, public_folder) failed_count = get_artifacts_for_jobs_and_return_num_failed( JOBS_FLOAT_REPO, public_folder ) if failed_count == len(JOBS): if failed_count == len(JOBS_FLOAT_REPO): sys.exit(1) pathlib.Path("ci/index-pages.html").rename(public_folder.joinpath("index.html")) sys.exit(0) def get_artifacts_for_jobs_and_return_num_failed(jobs: list, public_folder: pathlib.Path) -> int: def get_artifacts_for_jobs_and_return_num_failed( jobs: dict, public_folder: pathlib.Path ) -> int: """ Get specified artifact folders for all jobs given and put them into the public folder. jobs: dictionary with the job names in the keys and a list of the public folders to copy from the artifacts in the values if "-public" is in the list, the actual folder name to copy is the key with "-public" appended public_folder: target folder to copy stuff to """ failed_count = 0 for job in jobs: for job, artifact_folders in jobs.items(): job_id = get_job_id(os.environ["CI_COMMIT_REF_NAME"], job) print(f"{job_id} - {job}") try: curl_for_artifacts(job_id) job_public = job + "-public" if job == "coverage-test-on-main-scheduled": job_public = "coverage" pathlib.Path("coverage_stv").rename( public_folder.joinpath("coverage_stv") ) pathlib.Path(job_public).rename(public_folder.joinpath(job_public)) for fol in artifact_folders: if fol == PUBLIC_FOL_MAGIC: fol = job + fol pathlib.Path(fol).rename(public_folder.joinpath(fol)) except subprocess.CalledProcessError: print(f"Could not get artifacts for {job}") Loading