-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
497 additions
and
587 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: pkgx/brewkit/setup-codesign | ||
description: Codesigns macOS binaries using Apple tools | ||
|
||
inputs: | ||
p12-file-base64: | ||
description: Base64 encoded p12 file | ||
required: true | ||
p12-password: | ||
description: Password for p12 file | ||
required: true | ||
APPLE_IDENTITY: | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
# - name: purge tool PATH | ||
# run: | | ||
# if [ -d /usr/local/bin ]; then | ||
# tmp=$(mktemp -d) | ||
# sudo mv /usr/local/bin $tmp | ||
# fi | ||
# shell: bash | ||
|
||
- name: export APPLE_IDENTITY | ||
run: echo 'APPLE_IDENTITY=${{inputs.identity || '-'}}' >> $GITHUB_ENV | ||
shell: bash | ||
|
||
# the next three steps bless our code for Apple. It might be the case they should be | ||
# encapulated separately. | ||
# FIXME: using an explicit commit in a PR isn't great, but the last release was almost 3 years | ||
# ago, and we need bugfixes. | ||
# FIXME: replace this with a pkgx script based on https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions | ||
# github has a doc with similar content, but it's not returning to me atm. | ||
|
||
# apple-actions/import-codesign-certs will fail if the keychain already exists, so we prophylactically | ||
# delete it if it does. | ||
- name: Delete keychain | ||
shell: sh | ||
if: runner.os == 'macOS' && inputs.p12-file-password && inputs.p12-file-base64 | ||
run: security delete-keychain signing_temp.keychain || true | ||
|
||
- uses: apple-actions/import-codesign-certs@v2 | ||
if: runner.os == 'macOS' && inputs.p12-file-password && inputs.p12-file-base64 | ||
with: | ||
p12-file-base64: ${{ inputs.p12-file-base64 }} | ||
p12-password: ${{ inputs.p12-password }} | ||
|
||
# Needed for self-hosted runner, since it doesn't destroy itself automatically. | ||
- name: Delete keychain | ||
uses: webiny/[email protected] | ||
if: runner.os == 'macOS' && inputs.p12-file-password && inputs.p12-file-base64 | ||
with: | ||
run: security delete-keychain signing_temp.keychain |
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
}, | ||
"imports": { | ||
"pkgx": "https://deno.land/x/[email protected]/mod.ts", | ||
"pkgx/": "https://deno.land/x/[email protected]/src/" | ||
"pkgx/": "https://deno.land/x/[email protected]/src/", | ||
"is-what": "https://deno.land/x/[email protected]/src/index.ts" | ||
} | ||
} |
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,76 @@ | ||
#!/usr/bin/env -S pkgx deno run -A | ||
|
||
import { hooks, utils } from "pkgx" | ||
import { isString, isArray } from "is-what" | ||
|
||
const pkg = utils.pkg.parse(Deno.args[0]) | ||
|
||
const rv = {} as Record<string, any> | ||
for (const platform of await get_platforms(pkg)) { | ||
const key = platform.replace('/', '+') | ||
rv[key] = get_matrix(platform) | ||
} | ||
|
||
const ghout = Deno.env.get("GITHUB_OUTPUT") | ||
if (ghout) { | ||
const json = JSON.stringify(Object.values(rv)) | ||
Deno.writeTextFileSync(ghout, `matrix=${json}`, {append: true}) | ||
} else { | ||
const json = JSON.stringify(rv, null, 2) | ||
console.log(json) | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////// | ||
|
||
//TODO should be in libpkgx! | ||
async function get_platforms(pkg: {project: string}) { | ||
let { platforms } = await hooks.usePantry().project(pkg).yaml() | ||
if (!platforms) return ["linux/x86-64", "linux/aarch64", "darwin/x86-64", "darwin/aarch64"] | ||
if (isString(platforms)) platforms = [platforms] | ||
if (!isArray(platforms)) throw new Error(`invalid platform node: ${platforms}`) | ||
const rv = [] | ||
for (const platform of platforms) { | ||
if (platform.match(/^(linux|darwin)\/(aarch64|x86-64)$/)) rv.push(platform) | ||
else if (platform.match(/^(linux|darwin)$/)) rv.push(`${platform}/x86-64`, `${platform}/aarch64`) | ||
else throw new Error(`invalid platform: ${platform}`) | ||
} | ||
return rv | ||
} | ||
|
||
function get_matrix(platform: string) { | ||
const name = platform.replace('/', '+') | ||
switch (platform) { | ||
case 'darwin/aarch64': { | ||
const os = ["self-hosted", "macOS", "ARM64"] | ||
return { | ||
os, name, | ||
"test-os": [os], | ||
"test-container": [null], | ||
tinyname: "²" | ||
}} | ||
case 'darwin/x86-64': { | ||
const os = ["self-hosted", "macOS", "X64"] | ||
return { | ||
os, name, | ||
"test-os": ["macos-11", "macos-12"], | ||
"test-container": [null], | ||
tinyname: "x64" | ||
}} | ||
case 'linux/x86-64': { | ||
const os = {group: "linux-x86-64"} | ||
return { | ||
os, name, | ||
container: "debian:buster-slim", | ||
"test-os": [os], | ||
"test-container": ["debian:buster-slim", "ubuntu", "archlinux"], | ||
tinyname: "Lnx·x64" | ||
}} | ||
case 'linux/aarch64': { | ||
const os = ["self-hosted", "linux", "ARM64"] | ||
return { | ||
os, name, | ||
"test-os": [os], | ||
"test-container": [null], | ||
tinyname: "Lnx·ARM64" | ||
}}} | ||
} |
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,9 @@ | ||
#!/usr/bin/env -S pkgx deno run --allow-read | ||
|
||
import { hooks } from "pkgx" | ||
|
||
const project = Deno.args[0] | ||
|
||
const yml = await hooks.usePantry().project(project).yaml() | ||
const qaRequired = yml?.["test"]?.["qa-required"] === true | ||
Deno.exit(qaRequired ? 0 : 1) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.