Skip to content

Commit

Permalink
Move actions to separate directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Dec 7, 2024
1 parent cea3dc4 commit 3d18e54
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 deletions.
8 changes: 4 additions & 4 deletions README.md → actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ to reduce duplicated code within workflow YAML files. The custom actions are hos
[dmlc/xgboost-devops](https://github.com/dmlc/xgboost-devops>), to make it easy to test changes to the custom actions in
a pull request or a fork.

In a workflow file, we'd refer to `dmlc/xgboost-devops/{custom-action}@main`. For example:
In a workflow file, we'd refer to `dmlc/xgboost-devops/actions/{custom-action}@main`. For example:

```yaml
- uses: dmlc/xgboost-devops/miniforge-setup@main
- uses: dmlc/xgboost-devops/actions/miniforge-setup@main
with:
environment-name: cpp_test
environment-file: ops/conda_env/cpp_test.yml
```
Each custom action consists of two components:
* Main script (`dmlc/xgboost-devops/{custom-action}/action.yml`): dispatches to a specific version
* Main script (`dmlc/xgboost-devops/actions/{custom-action}/action.yml`): dispatches to a specific version
of the implementation script (see the next item). The main script clones `xgboost-devops` from
a specified fork at a particular ref, allowing us to easily test changes to the custom action.
* Implementation script (`dmlc/xgboost-devops/impls/{custom-action}/action.yml`): Implements the
* Implementation script (`dmlc/xgboost-devops/actions/impls/{custom-action}/action.yml`): Implements the
custom script.

This design was inspired by [Mike Sarahan](https://github.com/msarahan)'s work in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: load-base-env-vars
description: |
DO NOT USE THIS ACTION DIRECTLY.
Use dmlc/xgboost-devops/load-base-env-vars so that it can dispatch to
Use dmlc/xgboost-devops/actions/load-base-env-vars so that it can dispatch to
a specific version of the implementation.
runs:
Expand All @@ -26,4 +26,4 @@ runs:
else
echo "Load base env info: ignoring new value for "${env_var_name}" in loading base env vars. It is already set to "${!env_var_name}"." >&2;
fi
done <xgboost-ci-actions-env-vars
done <xgboost-ci-actions-env-vars
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Setup miniforge
description: |
DO NOT USE THIS ACTION DIRECTLY.
Use dmlc/xgboost-devops/miniforge-setup so that it can dispatch to
Use dmlc/xgboost-devops/actions/miniforge-setup so that it can dispatch to
a specific version of the implementation.
inputs:
environment-name:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Stash environment variables as a file
description: |
DO NOT USE THIS ACTION DIRECTLY.
Use dmlc/xgboost-devops/stash-base-env-vars so that it can dispatch to
Use dmlc/xgboost-devops/actions/stash-base-env-vars so that it can dispatch to
a specific version of the implementation.
runs:
Expand All @@ -20,4 +20,4 @@ runs:
name: xgboost-ci-actions-env-vars
path: xgboost-ci-actions-env-vars
- name: Re-export env vars so that defaults take effect
uses: ./xgboost-devops/impls/load-base-env-vars
uses: ./xgboost-devops/actions/impls/load-base-env-vars
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: load-base-env-vars
description: |
Clones a particular branch/ref of the dmlc/xgboost-devops repo, then
calls the implementation action dmlc/xgboost-devops/impls/load-base-env-vars,
calls the implementation action dmlc/xgboost-devops/actions/impls/load-base-env-vars,
which loads some environment variables from a file.
This script is the counterpart to dmlc/xgboost-devops/stash-base-env-vars.
This script is the counterpart to dmlc/xgboost-devops/actions/stash-base-env-vars.
It is called by child workflows to load variables that are set by the top-level
workflow.
Expand All @@ -19,5 +19,6 @@ runs:
repository: ${{ env.CUSTOM_ACTIONS_REPO || 'dmlc/xgboost-devops' }}
ref: ${{ env.CUSTOM_ACTIONS_REF || 'main' }}
path: ./xgboost-devops
sparse-checkout: actions
- name: Load base env vars
uses: ./xgboost-devops/impls/load-base-env-vars
uses: ./xgboost-devops/actions/impls/load-base-env-vars
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Setup miniforge
description: |
Set up a Conda environment using Miniforge. This action dispatches
to a specific version of impls/miniforge-setup.
to a specific version of dmlc/xgboost-devops/actions/impls/miniforge-setup.
inputs:
environment-name:
description: Name of Conda environment
Expand All @@ -19,8 +19,9 @@ runs:
repository: ${{ env.CUSTOM_ACTIONS_REPO || 'dmlc/xgboost-devops' }}
ref: ${{ env.CUSTOM_ACTIONS_REF || 'main' }}
path: ./xgboost-devops
sparse-checkout: actions
- name: Dispatch to implementation
uses: ./xgboost-devops/impls/miniforge-setup
uses: ./xgboost-devops/actions/impls/miniforge-setup
with:
environment-name: ${{ inputs.environment-name }}
environment-file: ${{ inputs.environment-file }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Stash environment variables as a file
description: |
Clones a particular branch/ref of the dmlc/xgboost-devops repo, then
calls the implementation action dmlc/xgboost-devops/impls/stash-base-env-vars,
calls the implementation action dmlc/xgboost-devops/actions/impls/stash-base-env-vars,
which writes some notable environment variables to a file.
This is a strategy to pass environment variable values between jobs. There are
Expand All @@ -22,5 +22,6 @@ runs:
repository: ${{ env.CUSTOM_ACTIONS_REPO || 'dmlc/xgboost-devops' }}
ref: ${{ env.CUSTOM_ACTIONS_REF || 'main' }}
path: ./xgboost-devops
sparse-checkout: actions
- name: Stash base env vars
uses: ./xgboost-devops/impls/stash-base-env-vars
uses: ./xgboost-devops/actions/impls/stash-base-env-vars

0 comments on commit 3d18e54

Please sign in to comment.