Skip to content

Commit

Permalink
more-tests (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl authored Aug 31, 2022
1 parent ac5c6ce commit a32cd0e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
25 changes: 17 additions & 8 deletions projects/freedesktop.org/pkg-config/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ distributable:
provides:
- bin/pkg-config

#NOTE that macOS provides some `.pc` files in /usr/lib/pkgconfig
# we don’t 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-/
Expand All @@ -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
9 changes: 8 additions & 1 deletion projects/ijg.org/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 21 additions & 2 deletions scripts/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
---*/
Expand All @@ -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])
Expand All @@ -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`
Expand Down Expand Up @@ -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)
}
}

0 comments on commit a32cd0e

Please sign in to comment.