Skip to content

Commit

Permalink
Merge pull request #771 from conda-forge/perf-no-init
Browse files Browse the repository at this point in the history
perf: remove init stage to run faster
  • Loading branch information
beckermr authored Nov 11, 2024
2 parents 9a3e3d6 + c2ecd63 commit f3ba5df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 73 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/webservices-workflow-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,52 +47,9 @@ defaults:
permissions: {}

jobs:
init-task:
name: init-task
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
ref: ${{ github.ref }}

- name: setup conda
uses: mamba-org/setup-micromamba@617811f69075e3fd3ae68ca64220ad065877f246
with:
environment-file: conda-lock.yml
environment-name: webservices
condarc: |
show_channel_urls: true
channel_priority: strict
channels:
- conda-forge
- name: install code
run: |
pip install --no-deps --no-build-isolation -e .
- name: init task
run: |
git config --global user.name "conda-forge-webservices[bot]"
git config --global user.email "91080706+conda-forge-webservices[bot]@users.noreply.github.com"
export CF_FEEDSTOCK_OPS_CONTAINER_NAME=condaforge/webservices-dispatch-action
export CF_FEEDSTOCK_OPS_CONTAINER_TAG="${{ inputs.container_tag }}"
conda-forge-webservices-init-task \
--task=${{ inputs.task }} \
--repo=${{ inputs.repo }} \
--pr-number=${{ inputs.pr_number }} \
--sha=${{ inputs.sha }}
env:
GH_TOKEN: ${{ secrets.CF_ADMIN_GITHUB_TOKEN }}

run-task:
name: run-task
runs-on: ubuntu-latest
needs:
- init-task
steps:
- name: checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
Expand Down
35 changes: 6 additions & 29 deletions conda_forge_webservices/github_actions_integration/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,6 @@ def _pull_docker_image():
print("::endgroup::", flush=True)


@click.command(name="conda-forge-webservices-init-task")
@click.option("--task", required=True, type=str)
@click.option("--repo", required=True, type=str)
@click.option("--pr-number", required=True, type=str)
@click.option("--sha", required=False, type=str, default=None)
def main_init_task(task, repo, pr_number, sha):
logging.basicConfig(level=logging.INFO)

action_desc = f"task `{task}` for conda-forge/{repo}#{pr_number}"
print(
f"::notice title=conda-forge-webservices job information::{action_desc}",
flush=True,
)

if task in ["rerender", "version_update"]:
pass
elif task == "lint":
_, gh = create_api_sessions()
gh_repo = gh.get_repo(f"conda-forge/{repo}")
target_url = (
f"https://github.com/conda-forge/conda-forge-webservices/"
f"actions/runs/{os.environ['GITHUB_RUN_ID']}"
)
set_pr_status(gh_repo, sha, "pending", target_url=target_url)
else:
raise ValueError(f"Task `{task}` is not valid!")


@click.command(name="conda-forge-webservices-run-task")
@click.option("--task", required=True, type=str)
@click.option("--repo", required=True, type=str)
Expand All @@ -90,7 +62,12 @@ def main_init_task(task, repo, pr_number, sha):
def main_run_task(task, repo, pr_number, task_data_dir, requested_version, sha):
setup_logging(level="DEBUG")

LOGGER.info("running task `%s` for conda-forge/%s#%s", task, repo, pr_number)
action_desc = f"task `{task}` for conda-forge/{repo}#{pr_number}"
LOGGER.info(action_desc)
print(
f"::notice title=conda-forge-webservices job information::{action_desc}",
flush=True,
)

feedstock_dir = os.path.join(
task_data_dir,
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ classifiers = [
[project.scripts]
update-webservices = "conda_forge_webservices.update_me:main"
cache-status-data = "conda_forge_webservices.status_monitor:cache_status_data"
conda-forge-webservices-init-task = "conda_forge_webservices.github_actions_integration.__main__:main_init_task"
conda-forge-webservices-run-task = "conda_forge_webservices.github_actions_integration.__main__:main_run_task"
conda-forge-webservices-finalize-task = "conda_forge_webservices.github_actions_integration.__main__:main_finalize_task"
conda-forge-webservices-automerge = "conda_forge_webservices.github_actions_integration.__main__:main_automerge"
Expand Down

0 comments on commit f3ba5df

Please sign in to comment.