Skip to content

test(pkgs): install and switch versions of every shipped package - #3036

Open
mikeland73 wants to merge 1 commit into
mikeland73/pkgdef-package-supportfrom
mikeland73/pkgdef-package-tests
Open

mikeland73 wants to merge 1 commit into
mikeland73/pkgdef-package-supportfrom
mikeland73/pkgdef-package-tests

Conversation

@mikeland73

Copy link
Copy Markdown
Collaborator

Summary

Sixth PR of the package definitions stack. Tests every package from #3034 against its real vendor. The focus is that install works and version switching works.

  • pkgs/<name>/<name>.test.txt: one testscript per package, next to its definition. Each script:

    1. installs version A from devbox.json;
    2. switches to version B with devbox add (which replaces A in devbox.json and devbox.lock);
    3. switches back by editing devbox.json.

    It checks the version at every step (node --version, java -version, ...), plus the definition's env where it matters: JAVA_HOME, RUSTUP_TOOLCHAIN, NPM_CONFIG_PREFIX, GOTOOLCHAIN, and pip running from the recreated .venv. Versions were picked to cover the interesting paths: pnpm 9 → 12 (npm then GitHub layout), yarn 1 → 4 (two npm packages), deno 1.46 (trust on first use), zig 0.13 → 0.14 (tarball rename), kubectl 1.30 (beyond the first page of GitHub releases), and gradle and maven running on the java definition.

  • TestPackageDefinitions (testscripts/) runs those scripts with $PKGS pointing at pkgs/. They download several GB, so they only run with DEVBOX_RUN_PKGDEF_TESTS=1. GITHUB_TOKEN is passed through for the GitHub API.

  • TestShippedDefinitionsParse (always runs) checks that every definition is valid, is named after its directory, and lists every platform, homepage, license and binaries.

  • TestShippedDefinitionsResolve (same flag) resolves and locks latest of every package against its vendor and requires vendor checksums.

  • pkgdef-tests workflow: both tests on ubuntu-latest and macos-latest, when pkgs/ or the implementation changes, and weekly to catch vendor changes.

Test plan

  • DEVBOX_RUN_PKGDEF_TESTS=1 go test ./testscripts -run TestPackageDefinitions: all 16 pass on macOS arm64 (about 2 min, parallel)
  • The same install, switch and check sequence for all 16 on Linux arm64, in jetpackio/devbox with a linux build of this branch
  • TestShippedDefinitionsResolve: all 16 resolve latest. Every platform is locked with a vendor checksum, except Temurin 27, which has no Intel macOS build
  • pkgdef-tests workflow on this PR (first run on x86_64 Linux)

🤖 Generated with Claude Code

Add a testscript next to every package definition in pkgs/. Each one
installs a version from devbox.json, switches to another with
`devbox add`, and switches back by editing devbox.json, checking the
version (and the definition's env, such as JAVA_HOME or the python
virtual environment) at every step. TestPackageDefinitions runs them with
$PKGS pointing at pkgs/ when DEVBOX_RUN_PKGDEF_TESTS=1, because they
download real toolchains.

TestShippedDefinitionsParse checks that every definition is valid and
named after its directory; it always runs. TestShippedDefinitionsResolve
resolves and locks the latest version of each against its vendor, behind
the same flag.

A pkgdef-tests workflow runs both on Linux and macOS when the definitions
or their implementation change, and weekly to catch vendor changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant