Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: check if installed command is really executable #22

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Ubuntu",
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"runArgs": ["--platform=linux/amd64"],
"workspaceFolder": "/workspace",
"remoteEnv": {
"PATH": "/root/.proto/shims:/root/.proto/bin:${containerEnv:PATH}"
Expand Down
2 changes: 2 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

curl -fsSL https://moonrepo.dev/install/proto.sh | PROTO_HOME=/usr/local bash -s -- --yes
cd /workspace
proto use
15 changes: 9 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ jobs:
config:
- os: macos-12
target: x86_64-apple-darwin
- os: macos-14
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: ubuntu-20.04
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu

steps:
- uses: actions/checkout@v4
- name: Install
uses: moonrepo/setup-toolchain@v0
with:
fetch-depth: 0
- uses: moonrepo/setup-toolchain@v0
env:
PROTO_LOG: debug
with:
auto-install: true
cache: false
- run: bun install --frozen-lockfile
- run: bun test
- run: yarn install --immutable
- run: moon ci --color -c 1
- uses: appthrust/moon-ci-retrospect@v0
if: success() || failure()
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,7 @@ dist

# Finder (MacOS) folder config
.DS_Store

# moon
.moon/cache
.moon/docker
8 changes: 8 additions & 0 deletions .moon/tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$schema: https://moonrepo.dev/schemas/tasks.json

tasks:
test:
command: vitest --run --pool=forks --passWithNoTests
inputs:
- "**/*.ts"
platform: node
40 changes: 40 additions & 0 deletions .moon/toolchain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://moonrepo.dev/docs/config/toolchain
$schema: https://moonrepo.dev/schemas/toolchain.json

node:
# The version to use. Must be a semantic version that includes major, minor, and patch.
# We suggest using the latest active LTS version: https://nodejs.org/en/about/releases
# version: '20.0.0'

# The package manager to use when managing dependencies.
# Accepts "npm" (default), "pnpm", "yarn", or "bun".
packageManager: yarn

# The version of the package manager (above) to use.
yarn:
version: 4.2.2
installArgs:
- --immutable

# Add `node.version` as a constraint in the root `package.json` `engines`.
addEnginesConstraint: true

# Dedupe dependencies after the lockfile has changed.
dedupeOnLockfileChange: true

# Version format to use when syncing dependencies within the project's `package.json`.
# dependencyVersionFormat: 'workspace'

# Infer and automatically create moon tasks from `package.json` scripts, per project.
# BEWARE: Tasks and scripts are not 1:1 in functionality, so please refer to the documentation.
inferTasksFromScripts: false

# Support the "one version policy" by only declaring dependencies in the root `package.json`.
# rootPackageOnly: true

# Sync a project's relationships as `dependencies` within the project's `package.json`.
syncProjectWorkspaceDependencies: true

# Sync `node.version` to a 3rd-party version manager's config file.
# Accepts "nodenv" (.node-version), "nvm" (.nvmrc), or none.
# syncVersionManagerConfig: 'nvm'
9 changes: 9 additions & 0 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$schema: https://moonrepo.dev/schemas/workspace.json

projects:
- "*"
- "!.*"

vcs:
manager: git
defaultBranch: main
6 changes: 5 additions & 1 deletion .prototools
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
bun = "1.1.15"
moon = "1.25.6"
node = "22.3.0"

[plugins]
moon = "https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml"
894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.2.2.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
yarnPath: .yarn/releases/yarn-4.2.2.cjs

nodeLinker: node-modules
8 changes: 8 additions & 0 deletions argo/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "argo",
afterInstall: async ($) => {
await $`argo version`;
},
});
8 changes: 8 additions & 0 deletions argocd/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "argocd",
afterInstall: async ($) => {
await $`argocd version --client`;
},
});
8 changes: 8 additions & 0 deletions black/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "black",
afterInstall: async ($) => {
await $`black --version`;
},
});
Binary file removed bun.lockb
Binary file not shown.
8 changes: 8 additions & 0 deletions cue/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "cue",
afterInstall: async ($) => {
await $`cue version`;
},
});
8 changes: 8 additions & 0 deletions fzf/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "fzf",
afterInstall: async ($) => {
await $`fzf --version`;
},
});
8 changes: 8 additions & 0 deletions gh/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "gh",
afterInstall: async ($) => {
await $`gh --version`;
},
});
21 changes: 0 additions & 21 deletions install.test.ts

This file was deleted.

8 changes: 8 additions & 0 deletions jnv/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "jnv",
afterInstall: async ($) => {
await $`jnv --version`;
},
});
8 changes: 8 additions & 0 deletions jq/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "jq",
afterInstall: async ($) => {
await $`jq --version`;
},
});
8 changes: 8 additions & 0 deletions k3d/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "k3d",
afterInstall: async ($) => {
await $`k3d --version`;
},
});
8 changes: 8 additions & 0 deletions k6/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "k6",
afterInstall: async ($) => {
await $`k6 --version`;
},
});
2 changes: 1 addition & 1 deletion k6/plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ download-file = "k6-v{version}-macos-{arch}.zip"
checksum-file = "k6-v{version}-checksums.txt"

[platform.windows]
bin-path = "k6-v{version}-windows-{arch}.exe/k6.exe"
bin-path = "k6-v{version}-windows-{arch}/k6.exe"
download-file = "k6-v{version}-windows-{arch}.zip"
checksum-file = "k6-v{version}-checksums.txt"

Expand Down
8 changes: 8 additions & 0 deletions k9s/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "k9s",
afterInstall: async ($) => {
await $`k9s version`;
},
});
8 changes: 8 additions & 0 deletions mise/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "mise",
afterInstall: async ($) => {
await $`mise --version`;
},
});
1 change: 1 addition & 0 deletions mise/plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ checksum-file = "SHASUMS256.txt"
[platform.windows]
download-file = "mise-v{version}-win-{arch}.zip"
checksum-file = "SHASUMS256.txt"
bin-path = "bin/mise.exe"

[install]
download-url = "https://github.com/jdx/mise/releases/download/v{version}/{download_file}"
Expand Down
30 changes: 21 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
{
"name": "proto-toml-plugin",
"type": "module",
"devDependencies": {
"@biomejs/biome": "^1.8.1",
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
"name": "proto-toml-plugin",
"type": "module",
"devDependencies": {
"@biomejs/biome": "^1.8.1",
"@tsconfig/node22": "^22.0.0",
"@tsconfig/strictest": "^2.0.5",
"@types/node": "^20.14.6",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"packageManager": "[email protected]",
"engines": {
"node": "22.3.0"
},
"dependencies": {
"toml": "^3.0.0",
"zx": "^8.1.3"
}
}
8 changes: 8 additions & 0 deletions rye/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "rye",
afterInstall: async ($) => {
await $`rye --version`;
},
});
7 changes: 3 additions & 4 deletions rye/plugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ checksum-file = "rye-{arch}-macos.gz.sha256"
download-file = "rye-{arch}-macos.gz"

[platform.windows]
bin-path = "rye-{arch}-windows.exe"
checksum-file = "rye-{arch}-windows.exe.sha256"
download-file = "rye-{arch}-windows.exe"
bin-path = "rye-x86-windows.exe"
checksum-file = "rye-x86-windows.exe.sha256"
download-file = "rye-x86-windows.exe"

[install]
checksum-url = "https://github.com/astral-sh/rye/releases/download/{version}/{checksum_file}"
Expand All @@ -23,7 +23,6 @@ download-url = "https://github.com/astral-sh/rye/releases/download/{version}/{do
[install.arch]
aarch64 = "aarch64"
x86_64 = "x86_64"
x86 = "x86"

[install.primary]
exe-path = "rye-{arch}-{os}"
Expand Down
8 changes: 8 additions & 0 deletions sccache/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "sccache",
afterInstall: async ($) => {
await $`sccache --version`;
},
});
8 changes: 8 additions & 0 deletions stern/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { run } from "../testkit.js";

run({
name: "stern",
afterInstall: async ($) => {
await $`stern --version`;
},
});
Loading
Loading