-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(ports): `jq` * fix: deno dir issue * fix(ci): minor troubles * fix(ci): typo * fix(tests): DENO_DIR trouble * fix(tests): missing cc * fix(tests): disable alpine hacks
- Loading branch information
Showing
12 changed files
with
212 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { | ||
$, | ||
DownloadArgs, | ||
dwnUrlOut, | ||
GithubReleasePort, | ||
InstallArgs, | ||
type InstallConfigSimple, | ||
osXarch, | ||
serializePlatform, | ||
} from "../port.ts"; | ||
import { GithubReleasesInstConf, readGhVars } from "../modules/ports/ghrel.ts"; | ||
|
||
const manifest = { | ||
ty: "denoWorker@v1" as const, | ||
name: "jq_ghrel", | ||
version: "0.1.0", | ||
moduleSpecifier: import.meta.url, | ||
platforms: [ | ||
...osXarch( | ||
["linux", "darwin"], | ||
["aarch64", "x86_64"], | ||
), | ||
serializePlatform({ os: "windows", arch: "x86_64" }), | ||
], | ||
}; | ||
|
||
export default function conf( | ||
config: InstallConfigSimple & GithubReleasesInstConf = {}, | ||
) { | ||
return { | ||
...readGhVars(), | ||
...config, | ||
port: manifest, | ||
}; | ||
} | ||
|
||
export class Port extends GithubReleasePort { | ||
repoOwner = "jqlang"; | ||
repoName = "jq"; | ||
|
||
downloadUrls(args: DownloadArgs) { | ||
const { installVersion, platform } = args; | ||
|
||
let arch; | ||
switch (platform.arch) { | ||
case "x86_64": | ||
arch = "amd64"; | ||
break; | ||
case "aarch64": | ||
arch = "arm64"; | ||
break; | ||
default: | ||
throw new Error(`unsupported platform: ${serializePlatform(platform)}`); | ||
} | ||
const os = platform.os == "darwin" ? "macos" : platform.os; | ||
|
||
return [ | ||
this.releaseArtifactUrl( | ||
installVersion, | ||
`jq-${os}-${arch}${os == "windows" ? "exe" : ""}`, | ||
), | ||
] | ||
.map(dwnUrlOut) | ||
.map((out) => ({ ...out, mode: 0o700 })); | ||
} | ||
|
||
async install(args: InstallArgs) { | ||
const installPath = $.path(args.installPath); | ||
await $.removeIfExists(installPath); | ||
|
||
const [{ name: fileName }] = this.downloadUrls(args); | ||
const fileDwnPath = $.path(args.downloadPath).resolve(fileName); | ||
|
||
await fileDwnPath.copyFile( | ||
(await installPath | ||
.join("bin") | ||
.ensureDir()) | ||
.join( | ||
args.platform.os == "windows" ? "jq.exe" : "jq", | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
ARG DENO_V=1.42.1 | ||
|
||
FROM docker.io/denoland/deno:alpine-${DENO_V} | ||
|
||
ARG BASH_V=5.2.21-r0 | ||
ARG FISH_V=3.6.3-r0 | ||
ARG ZSH_V=5.9-r2 | ||
ARG GIT_V=2.43.0-r0 | ||
ARG CURL_V=8.5.0-r0 | ||
ARG XZ_V=5.4.5-r0 | ||
ARG GTAR_V=1.35-r2 | ||
ARG UNZIP_V=6.0-r14 | ||
ARG ZSTD_V=1.5.5-r8 | ||
ARG GCOMPAT_V=1.1.0-r4 | ||
ARG BUILD_BASE_V=0.5-r3 | ||
|
||
RUN set -eux; \ | ||
apk update; \ | ||
apk add \ | ||
# ambient deps \ | ||
zstd=$ZSTD_V \ | ||
tar=$GTAR_V \ | ||
# test deps \ | ||
bash=$BASH_V \ | ||
fish=$FISH_V \ | ||
zsh=$ZSH_V \ | ||
# asdf deps \ | ||
git=$GIT_V \ | ||
curl=$CURL_V \ | ||
xz=$XZ_V \ | ||
unzip=$UNZIP_V \ | ||
build-base=$BUILD_BASE_V \ | ||
# gcompat=$GCOMPAT_V \ | ||
ca-certificates \ | ||
; | ||
|
||
WORKDIR /ghjk | ||
|
||
COPY deno.lock deno.jsonc ./ | ||
COPY deps/* ./deps/ | ||
RUN deno task cache | ||
|
||
COPY . ./ | ||
|
||
RUN ln -s ./main.ts /bin/ghjk | ||
|
||
WORKDIR /app | ||
|
||
ENV GHJK_LOG=debug | ||
ENV GHJK_INSTALL_EXE_DIR=/usr/bin | ||
ENV GHJK_INSTALL_HOOK_SHELLS=fish,bash,zsh | ||
# share the module cache of the image | ||
ENV GHJK_INSTALL_DENO_DIR=$DENO_DIR | ||
RUN deno run -A /ghjk/install.ts | ||
|
||
ARG GITHUB_TOKEN | ||
ENV GITHUB_TOKEN=$GITHUB_TOKEN | ||
|
||
# avoid variable expansion in the contents of the | ||
# here-document by quoting the tag | ||
COPY <<"EOT" /app/ghjk.ts | ||
#{{CMD_ADD_CONFIG}} | ||
EOT | ||
|
||
RUN <<EOT | ||
set -eux | ||
cat $(which ghjk) | ||
export CLICOLOR_FORCE=1 | ||
ghjk print config | ||
ghjk ports sync | ||
EOT | ||
|
||
# activate ghjk non-interactive shells execs | ||
ENV BASH_ENV=/root/.local/share/ghjk/env.bash | ||
ENV ZDOTDIR=/root/.local/share/ghjk/ | ||
|
||
# BASH_ENV behavior is only avail in bash, not sh | ||
SHELL [ "/bin/bash", "-c"] | ||
|
||
CMD ['false'] |
Oops, something went wrong.