mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 02:25:18 +03:00
rework for single pantry (#497)
* rework for single pantry * a few things missed
This commit is contained in:
parent
e7fc6d75a8
commit
11ca7336d7
7
.github/NEW_VERSION_ISSUE_TEMPLATE.md
vendored
Normal file
7
.github/NEW_VERSION_ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
title: "new release: {{env.PACKAGE}} failed"
|
||||||
|
assignees: jhheider
|
||||||
|
labels: bug
|
||||||
|
---
|
||||||
|
A new-version run for the {{env.PACKAGE}} release. Review the failure
|
||||||
|
<a href="{{env.URL}}">here</a> and mitigate.
|
23
.github/deno.jsonc
vendored
Normal file
23
.github/deno.jsonc
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": false,
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"typecheck": "deno check --unstable scripts/*.ts"
|
||||||
|
// ^^ doesn't work yet due to lack of glob support
|
||||||
|
},
|
||||||
|
"fmt": {
|
||||||
|
"files": {
|
||||||
|
"exclude": [
|
||||||
|
"./"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tea": {
|
||||||
|
"dependencies": {
|
||||||
|
"deno.land": "^1.30"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"importMap": "https://raw.githubusercontent.com/teaxyz/cli/v0.23/import-map.json"
|
||||||
|
}
|
33
.github/scripts/index-packages.ts
vendored
Executable file
33
.github/scripts/index-packages.ts
vendored
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env -S tea -E deno run --allow-read --allow-env --allow-net --allow-sys
|
||||||
|
|
||||||
|
import { usePantry } from "hooks"
|
||||||
|
import * as ARGV from "./utils/args.ts"
|
||||||
|
import { SQSClient, SendMessageCommand } from "npm:@aws-sdk/client-sqs@^3"
|
||||||
|
import { panic } from "utils"
|
||||||
|
|
||||||
|
const sqsClient = new SQSClient({ region: Deno.env.get("AWS_REGION") ?? panic("No region specified") })
|
||||||
|
const pantry = usePantry()
|
||||||
|
|
||||||
|
const pkgs = await ARGV.toArray(ARGV.pkgs())
|
||||||
|
for(const pkg of pkgs) {
|
||||||
|
try {
|
||||||
|
const yml = await pantry.getYAML(pkg).parse()
|
||||||
|
|
||||||
|
const project = pkg.project
|
||||||
|
|
||||||
|
const taskMessage = {
|
||||||
|
project,
|
||||||
|
github: yml?.versions?.github || "",
|
||||||
|
// TODO: add other useable data here eventually
|
||||||
|
}
|
||||||
|
const res = await sqsClient.send(new SendMessageCommand({
|
||||||
|
MessageGroupId: 'project',
|
||||||
|
MessageDeduplicationId: project,
|
||||||
|
MessageBody: JSON.stringify(taskMessage),
|
||||||
|
QueueUrl: Deno.env.get("SQS_GENERATE_PACKAGE_DETAILS_URL")!,
|
||||||
|
}))
|
||||||
|
console.log(`SQS task for pkg:${project} messageId:${res.MessageId}`)
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
41
.github/scripts/map-projects-to-githubs.ts
vendored
Executable file
41
.github/scripts/map-projects-to-githubs.ts
vendored
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env tea
|
||||||
|
|
||||||
|
/*---
|
||||||
|
args:
|
||||||
|
- deno
|
||||||
|
- run
|
||||||
|
- --allow-read
|
||||||
|
- --allow-env
|
||||||
|
- --allow-net
|
||||||
|
---*/
|
||||||
|
|
||||||
|
import { usePantry } from "hooks"
|
||||||
|
import { panic } from "utils"
|
||||||
|
import * as semver from "semver"
|
||||||
|
|
||||||
|
const url = Deno.env.get("WATCHER_URL") ?? panic("missing $WATCHER_URL")
|
||||||
|
const token = Deno.env.get("TEA_API_TOKEN") ?? panic("missing $TEA_API_TOKEN")
|
||||||
|
|
||||||
|
const pantry = usePantry()
|
||||||
|
|
||||||
|
const rv: Set<{project: string, github: string}> = new Set()
|
||||||
|
|
||||||
|
for await (const {project} of pantry.ls()) {
|
||||||
|
const yml = await pantry.getYAML({project, constraint: new semver.Range('*') }).parse()
|
||||||
|
if (yml?.versions?.github) {
|
||||||
|
const github = yml.versions.github.split('/').slice(0, 2).join('/')
|
||||||
|
rv.add({ project, github })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `bearer ${token}`,
|
||||||
|
},
|
||||||
|
body: JSON.stringify([...rv]),
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(rv)
|
||||||
|
await fetch(url, options)
|
59
.github/scripts/utils/args.ts
vendored
Normal file
59
.github/scripts/utils/args.ts
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
import { Installation, Package, PackageRequirement } from "types"
|
||||||
|
import { useCellar } from "hooks"
|
||||||
|
import { parse } from "utils/pkg.ts"
|
||||||
|
|
||||||
|
/// processes Deno.args unless STDIN is not a TTY and has input
|
||||||
|
export async function *args(): AsyncGenerator<string> {
|
||||||
|
if (Deno.isatty(Deno.stdin.rid)) {
|
||||||
|
for (const arg of Deno.args) {
|
||||||
|
if (arg[0] != '-') yield arg
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let yielded_something = false
|
||||||
|
const buf = new Uint8Array(10)
|
||||||
|
const decode = (() => { const d = new TextDecoder(); return d.decode.bind(d) })()
|
||||||
|
let n: number | null
|
||||||
|
let txt = ''
|
||||||
|
const rx = /\s*(.*?)\s+/
|
||||||
|
while ((n = await Deno.stdin.read(buf)) !== null) {
|
||||||
|
txt += decode(buf.subarray(0, n))
|
||||||
|
while (true) {
|
||||||
|
const match = txt.match(rx)
|
||||||
|
if (!match) break
|
||||||
|
yield match[1]
|
||||||
|
txt = txt.slice(match[0].length)
|
||||||
|
yielded_something = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (txt) {
|
||||||
|
yield txt
|
||||||
|
} else if (!yielded_something) {
|
||||||
|
for (const arg of Deno.args) {
|
||||||
|
yield arg
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function *pkgs(): AsyncGenerator<Package | PackageRequirement> {
|
||||||
|
for await (const arg of args()) {
|
||||||
|
const match = arg.match(/projects\/(.*)\/package.yml/)
|
||||||
|
const project = match ? match[1] : arg
|
||||||
|
yield parse(project)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function *installs(): AsyncGenerator<Installation> {
|
||||||
|
const cellar = useCellar()
|
||||||
|
for await (const pkg of pkgs()) {
|
||||||
|
yield await cellar.resolve(pkg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function toArray<T>(input: AsyncGenerator<T>) {
|
||||||
|
const rv: T[] = []
|
||||||
|
for await (const i of input) {
|
||||||
|
rv.push(i)
|
||||||
|
}
|
||||||
|
return rv
|
||||||
|
}
|
166
.github/workflows/bottle.yml
vendored
Normal file
166
.github/workflows/bottle.yml
vendored
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
name: bottle
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
new-version:
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
platform:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
outputs:
|
||||||
|
pr:
|
||||||
|
description: 'The PR number'
|
||||||
|
value: ${{ jobs.bottle.outputs.pr }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get-platform:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
os: ${{ steps.platform.outputs.os }}
|
||||||
|
cache-set: ${{ steps.platform.outputs.cache-set }}
|
||||||
|
steps:
|
||||||
|
- uses: teaxyz/brewkit/actions/get-platform@v0
|
||||||
|
id: platform
|
||||||
|
with:
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
|
||||||
|
bottle:
|
||||||
|
needs: [get-platform]
|
||||||
|
runs-on: ${{ fromJson(needs.get-platform.outputs.os) }}
|
||||||
|
outputs:
|
||||||
|
srcs: ${{ env.srcs }}
|
||||||
|
built: ${{ env.built }}
|
||||||
|
pr: ${{ env.PR }}
|
||||||
|
steps:
|
||||||
|
- uses: teaxyz/brewkit/actions/setup-brewkit@v0
|
||||||
|
id: tea
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
if: ${{ inputs.new-version }}
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.platform }}
|
||||||
|
|
||||||
|
- uses: teaxyz/brewkit/actions/fetch-pr-artifacts@v0
|
||||||
|
if: ${{ !inputs.new-version }}
|
||||||
|
with:
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
token: ${{ github.token }}
|
||||||
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_CACHE }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
|
||||||
|
- name: clean destination
|
||||||
|
# Note: needed when changing a directory to a symlink, for example in
|
||||||
|
# https://github.com/teaxyz/pantry.extra/pull/435
|
||||||
|
run: |
|
||||||
|
tar tzf $GITHUB_WORKSPACE/artifacts.tgz | \
|
||||||
|
awk '{ print length, $0 }' | \
|
||||||
|
sort -n -s -r | \
|
||||||
|
cut -d" " -f2- | \
|
||||||
|
xargs rm -rf
|
||||||
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
||||||
|
|
||||||
|
- run: tar xzvf $GITHUB_WORKSPACE/artifacts.tgz
|
||||||
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
for file in built srcs; do
|
||||||
|
echo "$file=$(cat $file)" >>$GITHUB_ENV
|
||||||
|
done
|
||||||
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
tea +gnupg.org gpg-agent --daemon || true
|
||||||
|
echo $GPG_PRIVATE_KEY | \
|
||||||
|
base64 -d | \
|
||||||
|
tea +gnupg.org gpg --import --batch --yes
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
|
||||||
|
- uses: teaxyz/brewkit/actions/bottle@v0
|
||||||
|
id: bottle-xz
|
||||||
|
with:
|
||||||
|
built: ${{ env.built }}
|
||||||
|
compression: xz
|
||||||
|
gpg-key-id: ${{ secrets.GPG_KEY_ID }}
|
||||||
|
gpg-key-passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
|
||||||
|
- uses: teaxyz/brewkit/actions/bottle@v0
|
||||||
|
id: bottle-gz
|
||||||
|
with:
|
||||||
|
built: ${{ env.built }}
|
||||||
|
compression: gz
|
||||||
|
gpg-key-id: ${{ secrets.GPG_KEY_ID }}
|
||||||
|
gpg-key-passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo ${{ steps.bottle-gz.outputs.bottles }} ${{ steps.bottle-xz.outputs.bottles }} >bottles
|
||||||
|
echo ${{ steps.bottle-gz.outputs.checksums }} ${{ steps.bottle-xz.outputs.checksums }} >checksums
|
||||||
|
echo ${{ steps.bottle-gz.outputs.signatures }} ${{ steps.bottle-xz.outputs.signatures }} >signatures
|
||||||
|
|
||||||
|
SRCS=$(echo $srcs | tr -d '~')
|
||||||
|
|
||||||
|
tar cf $GITHUB_WORKSPACE/artifacts.tar \
|
||||||
|
$SRCS \
|
||||||
|
${{ steps.bottle-gz.outputs.bottles }} \
|
||||||
|
${{ steps.bottle-xz.outputs.bottles }} \
|
||||||
|
bottles checksums signatures
|
||||||
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
||||||
|
|
||||||
|
- name: upload artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.platform }}-bottles
|
||||||
|
path: artifacts.tar
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
upload:
|
||||||
|
needs: [bottle]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: teaxyz/brewkit/actions/setup-brewkit@v0
|
||||||
|
with:
|
||||||
|
prefix: ${{ github.workspace }}
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.platform }}-bottles
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
tar xvf artifacts.tar
|
||||||
|
|
||||||
|
for file in bottles checksums signatures; do
|
||||||
|
echo "$file=$(cat $file)" >>$GITHUB_ENV
|
||||||
|
done
|
||||||
|
|
||||||
|
- uses: teaxyz/brewkit/actions/upload@v0
|
||||||
|
id: upload
|
||||||
|
with:
|
||||||
|
pkgs: ${{ needs.bottle.outputs.built }} ${{ needs.bottle.outputs.built }}
|
||||||
|
srcs: ${{ needs.bottle.outputs.srcs }} ${{ needs.bottle.outputs.srcs }}
|
||||||
|
bottles: ${{ env.bottles }}
|
||||||
|
checksums: ${{ env.checksums }}
|
||||||
|
signatures: ${{ env.signatures }}
|
||||||
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
|
||||||
|
- uses: chetan/invalidate-cloudfront-action@v2
|
||||||
|
env:
|
||||||
|
PATHS: ${{ steps.upload.outputs.cf-invalidation-paths }}
|
||||||
|
DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
|
||||||
|
AWS_REGION: us-east-1
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
|
||||||
|
complain:
|
||||||
|
needs: [upload]
|
||||||
|
if: inputs.new-version == 'true' && failure()
|
||||||
|
uses: ./.github/workflows/complain.yml
|
||||||
|
with:
|
||||||
|
projects: ${{ inputs.projects }}
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
secrets: inherit
|
177
.github/workflows/build.yml
vendored
Normal file
177
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
projects:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
platform:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
new-version:
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get-platform:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
os: ${{ steps.platform.outputs.os }}
|
||||||
|
build-os: ${{ steps.platform.outputs.build-os }}
|
||||||
|
container: ${{ steps.platform.outputs.container }}
|
||||||
|
test-matrix: ${{ steps.platform.outputs.test-matrix }}
|
||||||
|
cache-set: ${{ steps.platform.outputs.cache-set }}
|
||||||
|
steps:
|
||||||
|
- uses: teaxyz/brewkit/actions/get-platform@v0
|
||||||
|
id: platform
|
||||||
|
with:
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ${{ fromJson(needs.get-platform.outputs.build-os) }}
|
||||||
|
container: ${{ fromJson(needs.get-platform.outputs.container) }}
|
||||||
|
needs: [get-platform]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: teaxyz/brewkit/actions/setup-brewkit@v0
|
||||||
|
id: tea
|
||||||
|
with:
|
||||||
|
prefix: /opt
|
||||||
|
|
||||||
|
- name: sanitize macOS runners
|
||||||
|
if: fromJson(needs.get-platform.outputs.build-os) == 'macos-11'
|
||||||
|
run: sudo mv /usr/local/bin/* /tmp/
|
||||||
|
|
||||||
|
- run: pkg build ${{ inputs.projects }}
|
||||||
|
id: build
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
FORCE_UNSAFE_CONFIGURE: 1 # some configure scripts refuse to run as root
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
ABS_PATHS=$(echo $PATHS | tr ' ' '\n' | sed -e "s_^_$TEA_PREFIX/_" | tr '\n' ' ')
|
||||||
|
echo "paths=$ABS_PATHS" >> $GITHUB_OUTPUT
|
||||||
|
if: startsWith(inputs.platform, 'darwin+')
|
||||||
|
id: absolute-paths
|
||||||
|
env:
|
||||||
|
PATHS: ${{ steps.build.outputs.relative-paths }}
|
||||||
|
TEA_PREFIX: ${{ steps.tea.outputs.prefix }}
|
||||||
|
|
||||||
|
# sign macOS binaries
|
||||||
|
- uses: teaxyz/brewkit/actions/codesign@v0
|
||||||
|
if: startsWith(inputs.platform, 'darwin+') && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
|
||||||
|
with:
|
||||||
|
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE_P12 }}
|
||||||
|
p12-password: ${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }}
|
||||||
|
identity: "Developer ID Application: Tea Inc. (7WV56FL599)"
|
||||||
|
paths: ${{ steps.absolute-paths.outputs.paths }}
|
||||||
|
|
||||||
|
# cache data we'll need in the bottling job
|
||||||
|
- name: assemble artifact metadata
|
||||||
|
run: |
|
||||||
|
echo ${{ steps.build.outputs.pkgs }} >built
|
||||||
|
echo ${{ steps.build.outputs.srcs-relative-paths }} >srcs
|
||||||
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
||||||
|
|
||||||
|
# tarring ourselves ∵ GHA-artifacts (ludicrously) lose permissions
|
||||||
|
# /ref https://github.com/actions/upload-artifact/issues/38
|
||||||
|
- name: create artifacts.tgz
|
||||||
|
run:
|
||||||
|
tar czvf $GITHUB_WORKSPACE/artifacts.tgz
|
||||||
|
${{ steps.build.outputs.relative-paths }}
|
||||||
|
${{ steps.build.outputs.srcs-relative-paths }}
|
||||||
|
built srcs
|
||||||
|
working-directory: ${{ steps.tea.outputs.prefix }}
|
||||||
|
|
||||||
|
- name: upload artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.platform }}
|
||||||
|
path: artifacts.tgz
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
test:
|
||||||
|
needs: [get-platform, build]
|
||||||
|
runs-on: ${{ matrix.platform.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform: ${{ fromJson(needs.get-platform.outputs.test-matrix) }}
|
||||||
|
outputs:
|
||||||
|
HAS_SECRETS: ${{ env.HAS_SECRETS }}
|
||||||
|
container: ${{ matrix.platform.container }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: teaxyz/brewkit/actions/setup-brewkit@v0
|
||||||
|
|
||||||
|
- uses: teaxyz/setup@v0
|
||||||
|
with:
|
||||||
|
srcroot: null
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.platform }}
|
||||||
|
|
||||||
|
- name: clean destination
|
||||||
|
# Note: needed when changing a directory to a symlink, for example in
|
||||||
|
# https://github.com/teaxyz/pantry/pull/435
|
||||||
|
run: |
|
||||||
|
tar tzf $GITHUB_WORKSPACE/artifacts.tgz | \
|
||||||
|
awk '{ print length, $0 }' | \
|
||||||
|
sort -n -s -r | \
|
||||||
|
cut -d" " -f2- | \
|
||||||
|
xargs rm -rf
|
||||||
|
working-directory: ${{ env.TEA_PREFIX }}
|
||||||
|
|
||||||
|
- name: extract bottles
|
||||||
|
run: tar xzvf artifacts.tgz -C $TEA_PREFIX
|
||||||
|
|
||||||
|
- run: pkg test ${{ inputs.projects }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
# FIXME: this shouldn't be necessary, but it currently is for the
|
||||||
|
# ubuntu+container test matrix entries. :/
|
||||||
|
TEA_PANTRY_PATH: ${{ github.workspace }}
|
||||||
|
|
||||||
|
- name: '[post]'
|
||||||
|
run:
|
||||||
|
echo "HAS_SECRETS=$HAS_SECRETS" >>$GITHUB_ENV
|
||||||
|
env:
|
||||||
|
HAS_SECRETS: ${{ secrets.AWS_S3_CACHE != null }}
|
||||||
|
|
||||||
|
bottle:
|
||||||
|
needs: [test]
|
||||||
|
if: inputs.new-version == true
|
||||||
|
uses: ./.github/workflows/bottle.yml
|
||||||
|
with:
|
||||||
|
new-version: ${{ inputs.new-version }}
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
complain:
|
||||||
|
needs: [test]
|
||||||
|
if: inputs.new-version == true && failure()
|
||||||
|
uses: ./.github/workflows/complain.yml
|
||||||
|
with:
|
||||||
|
projects: ${{ inputs.projects }}
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
stage:
|
||||||
|
needs: [test]
|
||||||
|
# this only works for PRs from our team to our repo (security! :( )
|
||||||
|
if: startsWith(github.ref, 'refs/pull/') && github.repository_owner == 'teaxyz' && needs.test.outputs.HAS_SECRETS == 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ inputs.platform }}
|
||||||
|
|
||||||
|
- uses: teaxyz/brewkit/actions/stage-build-artifacts@v0
|
||||||
|
with:
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_CACHE }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
20
.github/workflows/cd.yml
vendored
20
.github/workflows/cd.yml
vendored
|
@ -1,8 +1,8 @@
|
||||||
name: cd
|
name: cd
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cd:
|
cd:
|
||||||
|
@ -11,11 +11,10 @@ jobs:
|
||||||
has-artifacts: ${{ steps.has-artifacts.outputs.has-artifacts }}
|
has-artifacts: ${{ steps.has-artifacts.outputs.has-artifacts }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
repository: teaxyz/pantry.core
|
|
||||||
|
|
||||||
- uses: teaxyz/brewkit/actions/setup-brewkit@v0
|
- uses: teaxyz/brewkit/actions/setup-brewkit@v0
|
||||||
|
|
||||||
|
# TODO: convert to teaxyz/brewkit/actions/map-projects-to-githubs
|
||||||
- run: .github/scripts/map-projects-to-githubs.ts
|
- run: .github/scripts/map-projects-to-githubs.ts
|
||||||
env:
|
env:
|
||||||
WATCHER_URL: ${{ secrets.WATCHER_URL }}
|
WATCHER_URL: ${{ secrets.WATCHER_URL }}
|
||||||
|
@ -42,7 +41,7 @@ jobs:
|
||||||
- linux+aarch64
|
- linux+aarch64
|
||||||
needs: [cd]
|
needs: [cd]
|
||||||
if: ${{ needs.cd.outputs.has-artifacts == 'true' }}
|
if: ${{ needs.cd.outputs.has-artifacts == 'true' }}
|
||||||
uses: teaxyz/pantry.core/.github/workflows/bottle.yml@main
|
uses: ./.github/workflows/bottle.yml
|
||||||
with:
|
with:
|
||||||
platform: ${{ matrix.platform }}
|
platform: ${{ matrix.platform }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
@ -76,6 +75,9 @@ jobs:
|
||||||
bottle-standalone:
|
bottle-standalone:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [cd]
|
needs: [cd]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
actions: write
|
||||||
if: ${{ needs.cd.outputs.has-artifacts == 'false' }}
|
if: ${{ needs.cd.outputs.has-artifacts == 'false' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -85,10 +87,12 @@ jobs:
|
||||||
PATTERNS: projects/**/package.yml
|
PATTERNS: projects/**/package.yml
|
||||||
- id: diff
|
- id: diff
|
||||||
run: |
|
run: |
|
||||||
RESULT=$(echo ${{ steps.get-diff.outputs.diff }} | sed 's#projects/\(.*\)/.*#\1#')
|
for x in ${{ steps.get-diff.outputs.diff }}; do
|
||||||
|
y=$(echo $x | sed 's#projects/\(.*\)/package.yml#\1#')
|
||||||
|
RESULT="$RESULT $y"
|
||||||
|
done
|
||||||
echo "diff=$RESULT" >> $GITHUB_OUTPUT
|
echo "diff=$RESULT" >> $GITHUB_OUTPUT
|
||||||
- run: gh workflow run new-version.yml -R teaxyz/pantry.core -f "projects=$PROJECTS"
|
- run: gh workflow run new-version.yml -f "projects=$PROJECTS"
|
||||||
if: ${{ steps.diff.outputs.diff != '' }}
|
if: ${{ steps.diff.outputs.diff != '' }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.TEMP_JACOBS_GITHUB_PAT }}
|
|
||||||
PROJECTS: ${{ steps.diff.outputs.diff }}
|
PROJECTS: ${{ steps.diff.outputs.diff }}
|
||||||
|
|
20
.github/workflows/ci-scripts.yml
vendored
Normal file
20
.github/workflows/ci-scripts.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
name: ci·scripts
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- .github/**.ts
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
typecheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: teaxyz/setup@v0
|
||||||
|
with:
|
||||||
|
srcroot: .github
|
||||||
|
- uses: teaxyz/brewkit/actions/cache@v0
|
||||||
|
with:
|
||||||
|
cache-name: ci-scripts
|
||||||
|
- run: deno check --unstable **/*.ts
|
||||||
|
working-directory: .github
|
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -1,4 +1,5 @@
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
on: pull_request
|
on: pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -29,7 +30,7 @@ jobs:
|
||||||
- darwin+aarch64
|
- darwin+aarch64
|
||||||
- linux+aarch64
|
- linux+aarch64
|
||||||
needs: [get-diff]
|
needs: [get-diff]
|
||||||
uses: teaxyz/pantry.core/.github/workflows/build.yml@main
|
uses: ./.github/workflows/build.yml
|
||||||
with:
|
with:
|
||||||
projects: ${{ needs.get-diff.outputs.diff || 'zlib.net^1.2' }}
|
projects: ${{ needs.get-diff.outputs.diff || 'zlib.net^1.2' }}
|
||||||
platform: ${{ matrix.platform }}
|
platform: ${{ matrix.platform }}
|
||||||
|
|
2
.github/workflows/cleanup.yml
vendored
2
.github/workflows/cleanup.yml
vendored
|
@ -24,6 +24,6 @@ jobs:
|
||||||
PR=$(echo ${{github.ref}} | sed -e 's_refs/pull/\(.*\)/merge_\1_')
|
PR=$(echo ${{github.ref}} | sed -e 's_refs/pull/\(.*\)/merge_\1_')
|
||||||
|
|
||||||
aws s3 rm --recursive s3://$AWS_S3_CACHE/pull-request/$REPO/$PR
|
aws s3 rm --recursive s3://$AWS_S3_CACHE/pull-request/$REPO/$PR
|
||||||
if: startsWith(github.ref, 'refs/pull/') && startsWith(github.repository, 'teaxyz/pantry.')
|
if: startsWith(github.ref, 'refs/pull/') && github.repository_owner == 'teaxyz'
|
||||||
env:
|
env:
|
||||||
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }}
|
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }}
|
41
.github/workflows/complain.yml
vendored
Normal file
41
.github/workflows/complain.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: complain
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
projects:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
platform:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
complain:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: martialonline/workflow-status@v3
|
||||||
|
id: status
|
||||||
|
|
||||||
|
- uses: rtCamp/action-slack-notify@v2
|
||||||
|
if: ${{ env.SLACK_WEBHOOK != '' }}
|
||||||
|
env:
|
||||||
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
|
||||||
|
SLACK_MESSAGE: new-version:${{ inputs.projects }} (${{ inputs.platform }}) ${{ steps.status.outputs.status }}
|
||||||
|
SLACK_COLOR: ${{ steps.status.outputs.status }}
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
if: github.ref_name == 'main'
|
||||||
|
|
||||||
|
- uses: JasonEtco/create-an-issue@v2
|
||||||
|
if: github.ref_name == 'main'
|
||||||
|
with:
|
||||||
|
filename: ./.github/NEW_VERSION_ISSUE_TEMPLATE.md
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PACKAGE: ${{ inputs.projects }} (${{ inputs.platform }})
|
||||||
|
URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
26
.github/workflows/index-data.yml
vendored
Normal file
26
.github/workflows/index-data.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
name: index-data
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
projects:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
queue-detail-ingestion:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: teaxyz/setup@v0
|
||||||
|
with:
|
||||||
|
srcroot: null
|
||||||
|
- uses: teaxyz/brewkit/actions/cache@v0
|
||||||
|
# TODO: convert to teaxyz/brewkit/actions/index-packages
|
||||||
|
- run: ./.github/scripts/index-packages.ts ${{ inputs.projects }}
|
||||||
|
env:
|
||||||
|
TEA_PANTRY_PATH: ${{ github.workspace }}
|
||||||
|
AWS_REGION: us-east-1
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
SQS_GENERATE_PACKAGE_DETAILS_URL: ${{ secrets.SQS_GENERATE_PACKAGE_DETAILS_URL }}
|
34
.github/workflows/new-version.yml
vendored
Normal file
34
.github/workflows/new-version.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
name: new-version
|
||||||
|
run-name: new-version (${{ inputs.projects }})
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
projects:
|
||||||
|
description: eg. `foo.com=1.2.3 bar.com^2.3.4`
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- darwin+x86-64
|
||||||
|
- linux+x86-64
|
||||||
|
- darwin+aarch64
|
||||||
|
- linux+aarch64
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
with:
|
||||||
|
new-version: true
|
||||||
|
projects: ${{ inputs.projects }}
|
||||||
|
platform: ${{ matrix.platform }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
index_data:
|
||||||
|
needs: [build]
|
||||||
|
if: success()
|
||||||
|
uses: ./.github/workflows/index-data.yml
|
||||||
|
with:
|
||||||
|
projects: ${{ inputs.projects }}
|
||||||
|
secrets: inherit
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -2,3 +2,6 @@
|
||||||
/builds
|
/builds
|
||||||
/testbeds
|
/testbeds
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
#TODO commit after v1
|
||||||
|
/deno.lock
|
||||||
|
|
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"deno.enable": true,
|
||||||
|
"deno.lint": true,
|
||||||
|
"deno.unstable": true,
|
||||||
|
"deno.config": ".github/deno.jsonc",
|
||||||
|
"deno.importMap": "../cli/import-map.json"
|
||||||
|
}
|
13
README.md
13
README.md
|
@ -1,7 +1,5 @@
|
||||||
![tea](https://tea.xyz/banner.png)
|
![tea](https://tea.xyz/banner.png)
|
||||||
|
|
||||||
This pantry is the complement to [pantry.core].
|
|
||||||
|
|
||||||
|
|
||||||
# What is a Pantry?
|
# What is a Pantry?
|
||||||
|
|
||||||
|
@ -29,9 +27,9 @@ other sources as much as possible, eg. versions are taken from the
|
||||||
Assuming you have tea (/w magic) installed:
|
Assuming you have tea (/w magic) installed:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git clone https://github.com/teaxyz/pantry.extra
|
$ git clone https://github.com/teaxyz/pantry
|
||||||
|
|
||||||
$ cd pantry.extra
|
$ cd pantry
|
||||||
# all the following commands operate in `./tea.out`
|
# all the following commands operate in `./tea.out`
|
||||||
# your tea installation remains untouched
|
# your tea installation remains untouched
|
||||||
|
|
||||||
|
@ -88,16 +86,13 @@ with their pull request then you can use GitHub’s CLI:
|
||||||
$ gh pr checkout 123
|
$ gh pr checkout 123
|
||||||
|
|
||||||
# or you can copy paste the URL:
|
# or you can copy paste the URL:
|
||||||
$ gh pr checkout https://github.com/teaxyz/pantry.extra/pull/123
|
$ gh pr checkout https://github.com/teaxyz/pantry/pull/123
|
||||||
|
|
||||||
# then open for editing:
|
# then open for editing:
|
||||||
$ pkg edit
|
$ pkg edit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[pantry.core]: https://github.com/teaxyz/pantry.core
|
[wiki]: https://github.com/teaxyz/pantry/wiki
|
||||||
[wiki]: https://github.com/teaxyz/pantry.extra/wiki
|
|
||||||
[tea/cli]: https://github.com/teaxyz/cli
|
|
||||||
[discussion]: https://github.com/orgs/teaxyz/discussions
|
[discussion]: https://github.com/orgs/teaxyz/discussions
|
||||||
[PAT]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
|
|
||||||
[IPFS]: https://ipfs.tech
|
[IPFS]: https://ipfs.tech
|
||||||
|
|
|
@ -29,7 +29,7 @@ build:
|
||||||
- -buildmode=pie
|
- -buildmode=pie
|
||||||
|
|
||||||
test: |
|
test: |
|
||||||
echo "teaxyz/pantry.extra" > repos.txt
|
echo "teaxyz/pantry" > repos.txt
|
||||||
mp init -f repos.txt
|
mp init -f repos.txt
|
||||||
# mp clone
|
# mp clone
|
||||||
# ^^ FIXME fails with exit code 128
|
# ^^ FIXME fails with exit code 128
|
||||||
|
|
|
@ -61,7 +61,7 @@ build:
|
||||||
- --prefix={{ prefix }}
|
- --prefix={{ prefix }}
|
||||||
- --libdir={{ prefix }}/lib
|
- --libdir={{ prefix }}/lib
|
||||||
- --enable-languages=c,c++,objc,obj-c++
|
- --enable-languages=c,c++,objc,obj-c++
|
||||||
- --with-bugurl="https://github.com/teaxyz/pantry.extra/issues"
|
- --with-bugurl="https://github.com/teaxyz/pantry/issues"
|
||||||
- --disable-bootstrap
|
- --disable-bootstrap
|
||||||
- --disable-nls
|
- --disable-nls
|
||||||
linux:
|
linux:
|
||||||
|
|
Loading…
Reference in a new issue