Skip to content

Commit dcedbaf

Browse files
committed
.some(bones)
1 parent 440d32e commit dcedbaf

File tree

325 files changed

+23714
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+23714
-0
lines changed

.envrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
PATH_add bin
2+
3+
export AWS_PROFILE=tea
4+
# export PKGX_PANTRY_DIR="$PWD/artifacts/pantry"
5+
# export PKGX_DIST_URL="https://dist.pkgx.dev/v2"
6+
7+
case $(uname)/$(uname -m) in
8+
Linux/x86_64)
9+
# export PKGX_DIR="$PWD/artifacts/linux/x86-64"
10+
;;
11+
Darwin/arm64)
12+
# export PKGX_DIR="$PWD/artifacts/darwin/aarch64"
13+
export DOCKER_DEFAULT_PLATFORM="linux/amd64"
14+
;;
15+
esac

.github/Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM debian:buster-slim AS stage1
2+
RUN apt-get update && apt-get install -y curl
3+
RUN curl https://pkgx.sh/$(uname)/$(uname -m).tgz | tar xz -C /usr/local/bin
4+
ENV PKGX_DIST_URL="https://dist.pkgx.dev/v2"
5+
RUN pkgx +llvm.org +make +patchelf +deno^2 >/dev/null
6+
COPY ./brewkit /work/brewkit
7+
COPY ./deno.jsonc /work/deno.jsonc
8+
COPY ./deno.lock /work/deno.lock
9+
RUN cd /work && find ./brewkit -name \*.ts | xargs pkgx deno cache
10+
RUN pkgx deno cache /work/.github/scripts/generate-versions
11+
12+
FROM debian:buster-slim AS stage2
13+
COPY --from=stage1 /usr/local/bin/pkgx /usr/local/bin/pkgx
14+
COPY --from=stage1 /root/.pkgx /root/.pkgx
15+
COPY --from=stage1 /root/.cache/deno /root/.cache/deno
16+
17+
# libc6-dev: platform specific c-headers that LLVM doesn’t provide
18+
# libgcc-8-dev: provides the c runtime `crtbeginS.o`
19+
RUN apt-get update && apt-get install --yes libc6-dev libgcc-8-dev
20+
21+
ENV PKGX_DIST_URL="https://dist.pkgx.dev/v2"

.github/actions/plan/action.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
runs:
2+
using: composite
3+
steps:
4+
# - id: changed-files
5+
# uses: tj-actions/changed-files@v45
6+
# with:
7+
# files: |
8+
# projects/**/build.ts
9+
# projects/**/test.ts
10+
# projects/**/versions.ts
11+
# if: ${{ ! inputs.pkgs }}
12+
13+
# - name: crunch diff
14+
# id: cruncher
15+
# run: |
16+
# PROJECTS=()
17+
# declare -A SEEN
18+
# for x in ${{ steps.changed-files.outputs.all_changed_files }}; do
19+
# x="$(dirname "${x#projects/}")"
20+
# if [ -z "${SEEN[$x]}" ]; then
21+
# PROJECTS+=("$x")
22+
# SEEN["$x"]=1
23+
# fi
24+
# done
25+
# echo "projects=${PROJECTS[@]}" >> "$GITHUB_OUTPUT"
26+
27+
# shell: bash
28+
# if: ${{ ! inputs.pkgs }}
29+
- name: compute matrix
30+
id: computer
31+
run:
32+
${GITHUB_ACTION_PATH}/compute-matrix.js
33+
${{ inputs.pkgs || steps.cruncher.outputs.projects || inputs.default }}
34+
--platforms ${{ inputs.platforms }}
35+
shell: bash
36+
if: ${{ inputs.compute-matrix }}
37+
38+
inputs:
39+
compute-matrix:
40+
default: true
41+
pkgs:
42+
required: false
43+
default:
44+
required: false
45+
platforms:
46+
required: false
47+
48+
outputs:
49+
projects:
50+
value: ${{ steps.cruncher.outputs.projects }}
51+
matrix:
52+
value: ${{ steps.computer.outputs.matrix }}
+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require("fs");
4+
const { parse } = require("yaml");
5+
const path = require("path");
6+
7+
(async function () {
8+
let pkgs = [];
9+
let platforms = process.argv.indexOf("--platforms");
10+
if (platforms != -1) {
11+
pkgs = process.argv.slice(2, platforms);
12+
if (process.argv[platforms + 1]) {
13+
platforms = [];
14+
for (const platform of process.argv.slice(platforms + 1)) {
15+
switch (platform) {
16+
case "linux":
17+
platforms.push("linux/x86-64");
18+
break;
19+
case "darwin":
20+
platforms.push("darwin/aarch64");
21+
break;
22+
case "windows":
23+
platforms.push("windows/x86-64");
24+
break;
25+
default:
26+
platforms.push(platform);
27+
break;
28+
}
29+
}
30+
} else {
31+
platforms = null;
32+
}
33+
} else {
34+
platforms = null;
35+
pkgs = process.argv.slice(2);
36+
}
37+
38+
const rvv = [];
39+
for (const arg of pkgs) {
40+
const config = await get_config(arg);
41+
42+
if (platforms) {
43+
config.platforms = config.platforms.filter((platform) => platforms.includes(platform));
44+
}
45+
46+
for (const platform of config.platforms) {
47+
const rv = {};
48+
rv["platform"] = get_matrix(platform);
49+
rv["pkg"] = arg;
50+
rvv.push(rv);
51+
}
52+
}
53+
54+
const json = JSON.stringify(rvv);
55+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `matrix=${json}\n`);
56+
})();
57+
58+
///////////////////////////////////////////////////////////////////////
59+
60+
async function get_config(pkgspec) {
61+
const project = pkgspec.split(/[*^~=@]/)[0];
62+
const file = path.join(
63+
path.dirname(path.dirname(path.dirname(path.dirname(__filename)))),
64+
"projects",
65+
project,
66+
"package.yml",
67+
);
68+
const data = fs.readFileSync(file, "utf8");
69+
const yaml = parse(data);
70+
71+
if (yaml.platforms === "*") {
72+
return { platforms: ["linux/x86-64", "darwin/aarch64", "windows/x86-64"] };
73+
} else if (Array.isArray(yaml.platforms)) {
74+
return { platforms: yaml.platforms };
75+
} else {
76+
return { platforms: [] };
77+
}
78+
}
79+
80+
function get_matrix(platform) {
81+
const name = platform.replace("/", "+");
82+
switch (platform) {
83+
case "darwin/aarch64":
84+
return {
85+
os: "macos-latest",
86+
name,
87+
tinyname: "²",
88+
};
89+
case "darwin/x86-64":
90+
return {
91+
os: ["self-hosted", "macOS", "X64"],
92+
name,
93+
tinyname: "x64",
94+
};
95+
case "linux/x86-64":
96+
return {
97+
os: "ubuntu-latest",
98+
name,
99+
container: "ghcr.io/pkgxdev/bldbot",
100+
tinyname: "*nix64",
101+
};
102+
case "linux/aarch64":
103+
return {
104+
os: ["self-hosted", "linux", "ARM64"],
105+
name,
106+
tinyname: "*nix·ARM64",
107+
};
108+
case "windows/x86-64":
109+
return {
110+
os: "windows-latest",
111+
name,
112+
tinyname: "win64",
113+
};
114+
}
115+
}

.github/actions/plan/node_modules/.bin/yaml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/plan/node_modules/.package-lock.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/plan/node_modules/yaml/LICENSE

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)