4D dependencies action

Resolve and install the components that a 4D project declares, in CI, the way 4D does, so tool4d can load them on GitHub-hosted runners.

Why it exists

A 4D project declares its components in Project/Sources/dependencies.json. In 4D and 4D Server, the dependency manager reads that file, downloads each component’s GitHub release, follows the components’ own dependencies, and loads everything.

In CI, that doesn’t work:

Without the components, the project is incomplete in CI. Code that calls a component fails to compile, and tests or analysis that depend on it can’t run.

This action fills that gap. It emulates the 4D dependency manager: it resolves the same versions 4D would, installs them in the same cache layout, and writes the same lock file. tool4d then finds and loads them as if 4D had installed them.

What it gives you

Same versions as 4D

Tags, exact versions, ranges, latest and "4d" anchors, nested dependencies, conflicts and cycles are resolved as real 4D resolves them.

Same cache layout

Components land in Dependencies/.github/<owner>/<repo>/<tag>/ under tool4d's, 4D's or 4D Server's user cache.

Same lock file

dependencies-lock.json is written in 4D's format, and its pins are honoured on later runs.

Ready for tool4d

An exact-tag copy of dependencies.json, plus the environment variables that point tool4d at an isolated cache.

Verified downloads

Release assets are checked against GitHub's SHA-256 digest, extracted safely, and kept in an archive store for offline runs.

Fails clearly

Anything that can't be resolved is reported with a reason, and the step fails by default.

Quick start

- uses: actions/setup-python@v6
  with:
    python-version: "3.12"
- name: Download tool4d
  id: tool4d
  uses: miyako/4D/.github/actions/tool4d-download@<commit-sha>
  with:
    platform: macos
    branch: 21.x
    version: "21.0"
    build: latest
    arch: arm
- name: Copy the project, so the checkout is never modified
  run: cp -R MyProject "$RUNNER_TEMP/MyProject"
- name: Install 4D dependencies
  id: dependencies
  uses: miyako/4D/.github/actions/dependencies@<commit-sha>
  with:
    project: ${{ runner.temp }}/MyProject
    runtime-path: ${{ steps.tool4d.outputs.tool4d_executable_path }}
    home: ${{ runner.temp }}/home
    rewrite: ${{ runner.temp }}/MyProject
    github-token: ${{ github.token }}

Then run tool4d with the variables from the env output, as shown in the tutorial. Pin the action to a commit SHA rather than a branch, so that a later change can’t alter your builds.

Where to go next

Status

Every rule described on this site was checked against real 4D, case by case, and the emulator matches 4D in every case tested. Most cases ran on 4D 21.2 and 21 R5 on macOS; earlier ones also covered 4D 21.0 and tool4d on Windows. Parity with 4D lists the cases.

GitLab: public GitLab components are supported for 4D 21 R3 and later, as in 4D, which doesn’t load them in 21.1 or 21.2. Private gitlab.com projects work with a token. Not yet observed in 4D: a local path declared inside a GitHub component. Both are reported as incomplete or with a warning, never guessed.

Requirements: Python 3.10 or later on the runner (only the standard library is used), and components published as GitHub releases with a <repo>.zip asset, as 4D itself requires.