mirror of
https://github.com/ivabus/pantry
synced 2025-06-08 08:20:32 +03:00
test +librsvg (#115)
This commit is contained in:
parent
88934db559
commit
42a666304d
5 changed files with 66 additions and 56 deletions
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
|
@ -66,39 +66,38 @@ jobs:
|
|||
TEA_SECRET: ${{ secrets.TEA_SECRET }}
|
||||
if: ${{ matrix.os == 'macos-11' }}
|
||||
|
||||
- name: topological sort
|
||||
- name: sort topologically
|
||||
run: scripts/sort.ts ${{ inputs.projects }}
|
||||
id: sorted
|
||||
run: ./scripts/sort.ts ${{ inputs.projects }}
|
||||
|
||||
- run: ./scripts/install.ts ${{ steps.sorted.outputs.pre-install }}
|
||||
- name: install deps
|
||||
run: ./scripts/install.ts ${{ steps.sorted.outputs.pre-install }}
|
||||
|
||||
- run: ./scripts/build.ts ${{ steps.sorted.outputs.pkgs }}
|
||||
- name: build
|
||||
run: ./scripts/build.ts ${{ steps.sorted.outputs.pkgs }}
|
||||
id: build
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
FORCE_UNSAFE_CONFIGURE: 1 # some configure scripts refuse to run as root
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
for x in ${{ steps.build.outputs.pkgs }}; do
|
||||
./scripts/test.ts $x
|
||||
done
|
||||
- name: test
|
||||
run: echo ${{ steps.build.outputs.pkgs }} | xargs -tn1 scripts/test.ts
|
||||
|
||||
- name: Bottle
|
||||
run: ./scripts/bottle.ts ${{ steps.build.outputs.pkgs }}
|
||||
- name: bottle
|
||||
run: scripts/bottle.ts ${{ steps.build.outputs.pkgs }}
|
||||
id: bottle
|
||||
|
||||
# TODO only upload if all jobs succeed
|
||||
# TODO only upload when we merge
|
||||
# TODO upload to a staging location until we release new pantry versions
|
||||
- name: Upload
|
||||
- name: upload bottles
|
||||
run: ./scripts/upload.ts ${{ steps.bottle.outputs.bottles }}
|
||||
env:
|
||||
AWS_S3: ${{ secrets.AWS_S3 }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Artifact
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.os }}
|
||||
|
|
|
@ -21,16 +21,14 @@ import build from "prefab/build.ts"
|
|||
import { Package, parsePackageRequirement, semver } from "types"
|
||||
import useFlags from "hooks/useFlags.ts"
|
||||
import usePlatform from "hooks/usePlatform.ts"
|
||||
import hydrate from "prefab/hydrate.ts"
|
||||
|
||||
useFlags()
|
||||
|
||||
const pantry = usePantry()
|
||||
const cellar = useCellar()
|
||||
|
||||
const dry = Deno.args.map(project => {
|
||||
const match = project.match(/projects\/(.*)\/package.yml/)
|
||||
return match ? match[1] : project
|
||||
}).map(parsePackageRequirement)
|
||||
const dry = Deno.args.map(parsePackageRequirement)
|
||||
|
||||
const rv: Package[] = []
|
||||
for (const pkgrq of dry) {
|
||||
|
@ -39,11 +37,6 @@ for (const pkgrq of dry) {
|
|||
if (!version) throw "no-version-found"
|
||||
const pkg = { project: pkgrq.project, version }
|
||||
|
||||
if (Deno.env.get("SKIP") && await cellar.isInstalled(pkg)) {
|
||||
console.log({ skipping: pkg.project })
|
||||
continue
|
||||
}
|
||||
|
||||
console.log({ building: pkgrq.project })
|
||||
|
||||
// Get the source
|
||||
|
@ -59,7 +52,10 @@ for (const pkgrq of dry) {
|
|||
})
|
||||
}
|
||||
|
||||
//TODO this was already calculated in `sort` and should not be recalculated
|
||||
const deps = await pantry.getDeps(pkg)
|
||||
const wet = await hydrate(deps.runtime, pkg => pantry.getDeps(pkg).then(x => x.runtime))
|
||||
deps.runtime.push(...wet.pkgs)
|
||||
|
||||
const env = usePlatform().platform == 'darwin'
|
||||
? {MACOSX_DEPLOYMENT_TARGET: ['11.0']}
|
||||
|
|
38
scripts/filter.ts
Executable file
38
scripts/filter.ts
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env -S tea -E
|
||||
|
||||
/*---
|
||||
args:
|
||||
- deno
|
||||
- run
|
||||
- --allow-net
|
||||
- --allow-run
|
||||
- --allow-read
|
||||
- --allow-write
|
||||
- --allow-env
|
||||
- --import-map={{ srcroot }}/import-map.json
|
||||
---*/
|
||||
|
||||
import { parsePackageRequirement } from "types"
|
||||
import useCellar from "hooks/useCellar.ts"
|
||||
import useFlags from "hooks/useFlags.ts"
|
||||
|
||||
useFlags()
|
||||
|
||||
/// filters out everything that is already installed
|
||||
|
||||
const cellar = useCellar()
|
||||
const desired_filter = !!Deno.env.get("INVERT")
|
||||
|
||||
const rv: string[] = []
|
||||
for (const pkg of Deno.args.map(parsePackageRequirement)) {
|
||||
const isInstalled = !!await cellar.isInstalled(pkg)
|
||||
if (isInstalled == desired_filter) {
|
||||
rv.push(pkg.project)
|
||||
}
|
||||
}
|
||||
|
||||
if (Deno.env.get("GITHUB_ACTIONS")) {
|
||||
console.log(`::set-output name=pkgs::${rv.join(" ")}\n`)
|
||||
} else {
|
||||
console.log(rv.join("\n"))
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
for x in $(scripts/ls.ts); do
|
||||
scripts/test.ts $x --magic
|
||||
done
|
|
@ -12,11 +12,10 @@ args:
|
|||
- --import-map={{ srcroot }}/import-map.json
|
||||
---*/
|
||||
|
||||
import { parsePackage, semver, Path, PackageRequirement, PlainObject, parsePackageRequirement } from "types"
|
||||
import { parsePackage, semver, Path, PackageRequirement, parsePackageRequirement } from "types"
|
||||
import usePantry from "hooks/usePantry.ts"
|
||||
import useShellEnv, { expand } from "hooks/useShellEnv.ts"
|
||||
import { run, undent, isPlainObject } from "utils"
|
||||
import { validatePackageRequirement } from "utils/lvl2.ts"
|
||||
import { run, undent } from "utils"
|
||||
import useFlags from "hooks/useFlags.ts"
|
||||
import useCellar from "hooks/useCellar.ts"
|
||||
import resolve from "prefab/resolve.ts"
|
||||
|
@ -24,14 +23,12 @@ import install from "prefab/install.ts"
|
|||
import hydrate from "prefab/hydrate.ts"
|
||||
import { lvl1 as link } from "prefab/link.ts"
|
||||
|
||||
const { debug } = useFlags()
|
||||
const { debug, magic } = useFlags()
|
||||
const cellar = useCellar()
|
||||
|
||||
//TODO install any other deps
|
||||
|
||||
const pantry = usePantry()
|
||||
|
||||
const pkg = await (async () => {
|
||||
if (Deno.args[1] == "--magic") {
|
||||
if (magic) {
|
||||
const i = await cellar.resolve(parsePackageRequirement(Deno.args[0]))
|
||||
return i.pkg
|
||||
} else {
|
||||
|
@ -44,11 +41,14 @@ const self = {
|
|||
constraint: new semver.Range(pkg.version.toString())
|
||||
}
|
||||
const [yml] = await pantry.getYAML(pkg)
|
||||
const deps: PackageRequirement[] = [self, ...await get_deps()]
|
||||
const deps = (await hydrate(self, async (pkg, dry) => {
|
||||
const { runtime, test } = await pantry.getDeps(pkg)
|
||||
return dry ? [...runtime, ...test] : runtime
|
||||
})).pkgs
|
||||
|
||||
await install_if_needed(deps)
|
||||
|
||||
const env = await useShellEnv(deps)
|
||||
const env = await useShellEnv([self, ...deps])
|
||||
|
||||
let text = undent`
|
||||
#!/bin/bash
|
||||
|
@ -69,7 +69,6 @@ try {
|
|||
text += `export FIXTURE="${fixture}"\n\n`
|
||||
}
|
||||
|
||||
|
||||
const cwd = tmp.join("wd").mkdir()
|
||||
|
||||
text += `cd "${cwd}"\n\n`
|
||||
|
@ -90,22 +89,7 @@ try {
|
|||
if (!debug) tmp.rm({ recursive: true })
|
||||
}
|
||||
|
||||
async function get_deps() {
|
||||
const rv: PackageRequirement[] = []
|
||||
attempt(yml.dependencies)
|
||||
attempt(yml.test.dependencies)
|
||||
const { pkgs } = await hydrate(rv, pkg => pantry.getDeps(pkg).then(x=>x.runtime))
|
||||
return pkgs
|
||||
|
||||
function attempt(obj: PlainObject) {
|
||||
if (isPlainObject(obj))
|
||||
for (const [project, constraint] of Object.entries(obj)) {
|
||||
const pkg = validatePackageRequirement({ project, constraint })
|
||||
if (pkg) rv.push(pkg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO install step should do this for test requirements also
|
||||
async function install_if_needed(deps: PackageRequirement[]) {
|
||||
const needed: PackageRequirement[] = []
|
||||
for await (const rq of deps) {
|
||||
|
|
Loading…
Reference in a new issue