mirror of
https://github.com/ivabus/pantry
synced 2024-09-20 16:50:50 +03:00
a2da161839
* simplify index-packages * Fix import map location * sqs modules needs permission :x * move matrices up a level * move `complain:` to bottle/build * more cleanup * add build-os key to get-platform.ts for self-hosted x86-64 (x64) runners * needs arrays not strings * implement testMatrix * review changes --------- Co-authored-by: Max Howell <mxcl@me.com>
60 lines
1.5 KiB
TypeScript
Executable file
60 lines
1.5 KiB
TypeScript
Executable file
#!/usr/bin/env tea
|
|
|
|
/*---
|
|
args:
|
|
- deno
|
|
- run
|
|
- --allow-read
|
|
- --allow-env
|
|
- --allow-write
|
|
---*/
|
|
|
|
import { panic } from "utils";
|
|
|
|
const platform = Deno.env.get("PLATFORM") ?? panic("$PLATFORM not set")
|
|
|
|
let os: string | string[]
|
|
let buildOs: string | string[]
|
|
let testMatrix: { os: string | string[], container: string | undefined }[]
|
|
|
|
switch(platform) {
|
|
case "darwin+x86-64":
|
|
os = "macos-11"
|
|
buildOs = ["self-hosted", "macOS", "X64"]
|
|
testMatrix = [{ os, container: undefined }]
|
|
break
|
|
case "darwin+aarch64":
|
|
os = ["self-hosted", "macOS", "ARM64"]
|
|
buildOs = os
|
|
testMatrix = [{ os, container: undefined }]
|
|
break
|
|
case "linux+aarch64":
|
|
os = ["self-hosted", "linux", "ARM64"]
|
|
buildOs = os
|
|
testMatrix = [{ os, container: undefined }]
|
|
break
|
|
case "linux+x86-64":
|
|
os = "ubuntu-latest"
|
|
buildOs = ["self-hosted", "linux", "X64"]
|
|
testMatrix = [
|
|
{ os, container: undefined },
|
|
{ os: buildOs, container: undefined },
|
|
{ os, container: "ghcr.io/teaxyz/infuser:latest" },
|
|
{ os, container: "debian:buster-slim" },
|
|
]
|
|
break
|
|
default:
|
|
panic(`Invalid platform description: ${platform}`)
|
|
}
|
|
|
|
const output = `os=${JSON.stringify(os)}\n` +
|
|
`build-os=${JSON.stringify(buildOs)}\n` +
|
|
`test-matrix=${JSON.stringify(testMatrix)}\n`
|
|
|
|
Deno.stdout.write(new TextEncoder().encode(output))
|
|
|
|
if (Deno.env.get("GITHUB_OUTPUT")) {
|
|
const envFile = Deno.env.get("GITHUB_OUTPUT")!
|
|
await Deno.writeTextFile(envFile, output, { append: true})
|
|
}
|