more-tests (#106)

This commit is contained in:
Max Howell 2022-08-31 17:44:34 -04:00 committed by GitHub
parent ac5c6ceff3
commit a32cd0e80a
4 changed files with 46 additions and 16 deletions

View file

@ -1,11 +1,6 @@
name: ci
on: pull_request
# concurrency:
# #TODO group: ${{ github.ref }}
# group: only-one-due-to-versions.txt-generation-requiring-serial-ness
# cancel-in-progress: true
jobs:
get-diff:
runs-on: ubuntu-latest

View file

@ -5,6 +5,13 @@ distributable:
provides:
- bin/pkg-config
#NOTE that macOS provides some `.pc` files in /usr/lib/pkgconfig
# we dont explicitly include them. This should be safe since we set
# PKG_CONFIG_PATH and that is checked first. But it could lead to issues
# for users in some circumstances.
#FIXME probably we should exclude this in the pursuit of reliable, cross
# platform environments.
versions:
github: freedesktop/pkg-config/tags
strip: /^pkg-config-/
@ -14,14 +21,16 @@ build:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
script: |-
./configure \
--prefix="{{ prefix }}" \
--disable-debug \
--disable-host-tool \
--with-internal-glib \
--with-pc-path=/usr/lib/pkgconfig #FIXME
make --jobs {{ hw.concurrency }}
make install
./configure $ARGS
make --jobs {{ hw.concurrency }} install
env:
ARGS:
- --prefix="{{ prefix }}"
- --disable-debug
- --disable-host-tool
- --with-internal-glib
# otherwise the defaults are based on our {{prefix}}
- --with-pc-path=/usr/lib/pkgconfig:/usr/share/pkgconfig
test:
script: pkg-config --version

View file

@ -20,4 +20,11 @@ build:
--prefix="{{ prefix }}"
make --jobs {{ hw.concurrency }} install
test: true #FIXME
test:
dependencies:
curl.se: '*'
env:
FIXTURE: https://samplelib.com/lib/preview/jpeg/sample-clouds-400x300.jpg
script: |
curl $FIXTURE > test.jpeg
djpeg test.jpeg

View file

@ -7,7 +7,7 @@ args:
- --allow-net
- --allow-run
- --allow-read
- --allow-write=/opt/tea.xyz/tmp
- --allow-write
- --allow-env
- --import-map={{ srcroot }}/import-map.json
---*/
@ -19,16 +19,20 @@ import { run, undent, isPlainObject } from "utils"
import { validatePackageRequirement } from "utils/lvl2.ts"
import useFlags from "hooks/useFlags.ts"
import useCellar from "hooks/useCellar.ts"
import resolve from "prefab/resolve.ts"
import install from "prefab/install.ts"
import hydrate from "prefab/hydrate.ts"
import { lvl1 as link } from "prefab/link.ts"
const { debug } = useFlags()
const cellar = useCellar()
//TODO install any other deps
const pantry = usePantry()
const pkg = await (async () => {
if (Deno.args[1] == "--magic") {
const i = await useCellar().resolve(parsePackageRequirement(Deno.args[0]))
const i = await cellar.resolve(parsePackageRequirement(Deno.args[0]))
return i.pkg
} else {
return parsePackage(Deno.args[0])
@ -42,6 +46,8 @@ const self = {
const [yml] = await pantry.getYAML(pkg)
const deps: PackageRequirement[] = [self, ...await get_deps()]
await install_if_needed(deps)
const env = await useShellEnv(deps)
let text = undent`
@ -98,3 +104,16 @@ async function get_deps() {
}
}
}
async function install_if_needed(deps: PackageRequirement[]) {
const needed: PackageRequirement[] = []
for await (const rq of deps) {
if (await cellar.isInstalled(rq)) continue
needed.push(rq)
}
const wet = await resolve(needed)
for (const pkg of wet) {
const installation = install(pkg)
await link(installation)
}
}