Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jan 26, 2025
1 parent f18a909 commit bcfedc3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/actions/mounts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:
const cache = require('@actions/cache');
const data = ${{ toJSON(fromJSON(steps.dependencies.outputs.data)) }};
// Make actions/cache's getWorkingDirectory() return process.cwd.
delete process.env.GITHUB_GITHUB_WORKSPACE;
delete process.env.GITHUB_WORKSPACE;
for (const mount of data) {
const dir = path.join('cache', mount.key, path.dirname(mount.artifact));
fs.mkdirSync(dir, { recursive: true });
Expand Down
3 changes: 1 addition & 2 deletions .github/actions/task/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ runs:
shell: bash
# if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
find . -ls
python3 CI/run.py --cache cache --out . "${{ inputs.name }}"
python3 CI/run.py --cache cache --no-recurse --out . "${{ inputs.name }}"
11 changes: 8 additions & 3 deletions CI/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def link_or_copy(src, dest):
raise


def run_task(task, cwd, out=None, cache=None):
def run_task(task, cwd, out=None, cache=None, recurse=True):
id = task.id
task = task.task
payload = task.get("payload", {})
Expand All @@ -44,8 +44,12 @@ def run_task(task, cwd, out=None, cache=None):
else:
artifacts_base_dir = os.path.join(cwd, task_id)
artifact = os.path.join(artifacts_base_dir, content["artifact"])
print(artifact, os.path.exists(artifact))
if not os.path.exists(artifact):
run_task(dep_task, cwd, cache=cache)
if recurse:
run_task(dep_task, cwd, cache=cache)
else:
raise RuntimeError("Missing dependency")

if directory := mount.get("directory"):
assert "file" not in mount
Expand Down Expand Up @@ -101,6 +105,7 @@ def main():
parser.add_argument("--out", type=str, metavar="PATH")
parser.add_argument("--route", action="store_true")
parser.add_argument("--mounts", action="store_true")
parser.add_argument("--no-recurse", action="store_true")
parser.add_argument("task")
args = parser.parse_args()
action.by_name["decision"].func()
Expand Down Expand Up @@ -130,7 +135,7 @@ def info(mount):
with tempfile.TemporaryDirectory(prefix="run_task") as tmpdir:
for t in Task.by_id.values():
if t.task.get("metadata", {}).get("name") == args.task:
run_task(t, cwd=tmpdir, out=args.out, cache=args.cache)
run_task(t, cwd=tmpdir, out=args.out, cache=args.cache, recurse=not args.no_recurse)
break


Expand Down

0 comments on commit bcfedc3

Please sign in to comment.