Skip to content

Commit e7251b9

Browse files
authored
v1 (#210)
* rewrite in mostly TypeScript * `pkg` -> `bk` to avoid confusion with `pkgx` * proper actions * pkgx pantry specific infra moved to pantry * irrelevant commands removed to be put into `mash` * changes are now fully tested in CI without needing pkgx pantry packages * Fixes #173 * builds occur to separate prefix to aid relocatability testing (Fixes #166) * Refs #160 * Fixes #158 * Fixes #157 * Fixes #129 * Fixes #117 (though I didn’t explicitly fix this we have a fixture showing this working now) * Feat: initializes a git repo in the sources so you can easily get a diff for your build script * Allow `bk docker --pull foo`
1 parent 88841c1 commit e7251b9

115 files changed

Lines changed: 1981 additions & 3100 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.actions.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
on:
2+
pull_request:
3+
workflow_call:
4+
5+
env:
6+
# FIXME
7+
# we must set this or pkgx won’t find the main pantry after $HOME is changed
8+
# because the default is based on $HOME and we don’t sync if $PKGX_PANTRY_PATH is set
9+
# FIXME add PKGX_HOME to libpkgx
10+
XDG_DATA_HOME: ${{github.workspace}}/.data
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.platform.os }}
15+
outputs:
16+
pkgspec: ${{ steps.build.outputs.pkgspec }}
17+
env:
18+
PKGX_PANTRY_PATH: ${{github.workspace}}/co
19+
strategy:
20+
matrix:
21+
platform:
22+
- os: ubuntu-latest
23+
name: linux
24+
- os: macos-latest
25+
name: darwin
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
30+
31+
- uses: pkgxdev/setup@v2
32+
33+
- uses: ./co/build
34+
id: build
35+
with:
36+
pkg: stark.com/foo
37+
38+
- run: test ${{ steps.build.outputs.pkgspec }} = stark.com/foo=2.3.4
39+
- run: test ${{ steps.build.outputs.project }} = stark.com/foo
40+
- run: test ${{ steps.build.outputs.version }} = 2.3.4
41+
- run: test ${{ steps.build.outputs.platform }} = ${{ matrix.platform.name }}
42+
- run: test ${{ steps.build.outputs.arch }} = x86-64
43+
- run: test -d ${{ steps.build.outputs.prefix }}
44+
- run: test $BREWKIT_PKGSPEC = ${{ steps.build.outputs.pkgspec }}
45+
- run: test $BREWKIT_PREFIX = ${{ steps.build.outputs.prefix }}
46+
47+
- uses: ./co/upload-build-artifact
48+
49+
test:
50+
needs: build
51+
strategy:
52+
matrix:
53+
os:
54+
- ubuntu-latest
55+
- macos-latest
56+
runs-on: ${{ matrix.os }}
57+
env:
58+
PKGX_PANTRY_PATH: ${{github.workspace}}/co
59+
steps:
60+
- uses: actions/checkout@v4
61+
with:
62+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
63+
- uses: pkgxdev/setup@v2
64+
- uses: ./co/download-build-artifact
65+
- uses: ./co/test
66+
with:
67+
pkg: ${{ needs.build.outputs.pkgspec }}
68+
69+
audit:
70+
needs: build
71+
runs-on: ubuntu-latest
72+
strategy:
73+
matrix:
74+
os:
75+
- ubuntu-latest
76+
- macos-latest
77+
env:
78+
PKGX_PANTRY_PATH: ${{github.workspace}}/co
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
83+
- uses: pkgxdev/setup@v2
84+
- uses: ./co/download-build-artifact
85+
- uses: ./co/audit
86+
with:
87+
pkg: ${{ needs.build.outputs.pkgspec }}
88+
89+
bottle:
90+
needs: build
91+
runs-on: ubuntu-latest
92+
strategy:
93+
matrix:
94+
compression: [xz, gz]
95+
platform:
96+
- darwin+x86-64
97+
- linux+x86-64
98+
steps:
99+
- uses: actions/checkout@v4
100+
with:
101+
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
102+
103+
- uses: pkgxdev/setup@v2
104+
105+
- uses: ./co/download-build-artifact
106+
id: dl
107+
with:
108+
extract: false
109+
platform: ${{ matrix.platform }}
110+
111+
- uses: ./co/bottle
112+
id: bottle
113+
with:
114+
file: ${{ steps.dl.outputs.filename }}
115+
compression: ${{matrix.compression}}
116+
117+
- uses: actions/upload-artifact@v3
118+
with:
119+
path: ${{ steps.bottle.outputs.filename }}
120+
name: ${{ steps.bottle.outputs.name }}
121+
122+
unavailable:
123+
runs-on: ubuntu-latest
124+
steps:
125+
- uses: actions/checkout@v4
126+
- uses: pkgxdev/setup@v2
127+
128+
- uses: ./build
129+
id: build
130+
with:
131+
pkg: unavailable.com
132+
env:
133+
PKGX_PANTRY_PATH: ${{github.workspace}}
134+
135+
- run: echo ${{steps.build.outputs.noop}}
136+
137+
- run: exit 1
138+
if: ${{steps.build.outputs.noop != 'true'}}

.github/workflows/ci.cli.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
on:
2+
pull_request:
3+
workflow_call:
4+
5+
env:
6+
GITHUB_TOKEN: ${{github.token}}
7+
PKGX_PANTRY_PATH: ${{github.workspace}}
8+
# FIXME
9+
# we must set this or pkgx won’t find the main pantry after $HOME is changed
10+
# because the default is based on $HOME and we don’t sync if $PKGX_PANTRY_PATH is set
11+
# FIXME add PKGX_HOME to libpkgx
12+
XDG_DATA_HOME: ${{github.workspace}}/.data
13+
14+
jobs:
15+
integration-tests:
16+
name: ${{matrix.pkg}} (${{matrix.platform.tag}})
17+
strategy:
18+
matrix:
19+
platform:
20+
- os: ubuntu-latest
21+
img: debian:buster-slim
22+
tag: linux
23+
- os: macos-latest
24+
tag: mac
25+
pkg:
26+
- stark.com/foo
27+
- toolchain.com
28+
- pyapp.com/1
29+
- pyapp.com/2
30+
- stark.com/foo@1.2.3
31+
runs-on: ${{ matrix.platform.os }}
32+
container: ${{ matrix.platform.img }}
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: pkgxdev/setup@v2
36+
37+
- name: precache # makes it easier to read the real output
38+
run: | # we have to make symlinks because deno cache doesn’t take a --ext=ts flag
39+
ln -s bin/cmd/build build.ts
40+
ln -s bin/cmd/test test.ts
41+
pkgx deno cache *.ts
42+
rm *.ts
43+
44+
- run: bin/bk build ${{matrix.pkg}}
45+
- run: bin/bk test ${{matrix.pkg}}
46+
- run: bin/bk audit ${{matrix.pkg}}
47+
48+
local-edit-tests:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: pkgxdev/setup@v2
53+
- run: pkgx --sync #FIXME bug where shebangs don’t cause an auto-sync
54+
- uses: fregante/setup-git-user@v2
55+
- run: git update-ref refs/remotes/origin/main HEAD
56+
- run: '! bin/bk status'
57+
- run: cp package-mod.yml package.yml
58+
working-directory: projects/stark.com/foo
59+
- run: test $(bin/bk status) = stark.com/foo
60+
- run: bin/bk build
61+
- run: bin/bk test
62+
- run: test $(pkgx +stark.com/foo -- stark) = not_much_u
63+
- run: bin/bk audit
64+
65+
unit-tests:
66+
runs-on: ubuntu-latest
67+
env:
68+
PKGX_PANTRY_PATH: null
69+
steps:
70+
- uses: actions/checkout@v4
71+
- uses: pkgxdev/dev@main
72+
- run: deno test --allow-env --allow-net --ignore=.data
73+
74+
unavailable:
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
- uses: pkgxdev/setup@v2
79+
- run: pkgx --sync # FIXME PKGX_PANTRY_PATH causes auto sync to fail
80+
- name: build
81+
run: |
82+
set +e
83+
bin/bk build unavailable.com
84+
test $? -eq 2

.github/workflows/ci.yml

Lines changed: 4 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,8 @@
11
on:
2-
pull_request:
32
workflow_dispatch:
43

54
jobs:
6-
integration-tests:
7-
runs-on: ubuntu-latest
8-
env:
9-
GITHUB_TOKEN: ${{ github.token }}
10-
strategy:
11-
fail-fast: false
12-
matrix:
13-
pkgs:
14-
- zlib.net
15-
- openssl.org^1.1 curl.se/ca-certs
16-
- pipenv.pypa.io
17-
- poppler.freedesktop.org/poppler-data
18-
- catb.org/wumpus
19-
- c-ares.org
20-
- vim.org
21-
- curl.se
22-
# FIXME? requires a darwin platform to run, and needs
23-
# macOS 12 to test. That'll require a more complex matrix
24-
# using get-platform.
25-
# - github.com/realm/SwiftLint
26-
container:
27-
image: debian:buster-slim
28-
steps:
29-
- uses: actions/checkout@v4
30-
- uses: ./actions/setup-brewkit
31-
32-
# prefetch deno deps to make the output from the build step more legible
33-
- run: pkgx deno cache **/*.ts
34-
35-
- run: pkg build ${{matrix.pkgs}}
36-
id: build
37-
38-
- run: test -n '${{ steps.build.outputs.pkgs }}'
39-
- run: test -n '${{ steps.build.outputs.relative-paths }}'
40-
41-
- run: |
42-
if pkg query ${{ steps.build.outputs.pkgs }} --src 2>&1 | grep -E '^warn: pkg has no srcs:'; then
43-
echo "srcs=false" >> $GITHUB_OUTPUT
44-
else
45-
echo "srcs=true" >> $GITHUB_OUTPUT
46-
fi
47-
id: srcs
48-
49-
- run: test -n '${{ steps.build.outputs.srcs }}'
50-
if: steps.srcs.outputs.srcs == 'true'
51-
52-
- run: test -n '${{ steps.build.outputs.srcs-relative-paths }}'
53-
if: steps.srcs.outputs.srcs == 'true'
54-
55-
- run: pkg test ${{matrix.pkgs}}
56-
57-
typecheck:
58-
runs-on: ubuntu-latest
59-
steps:
60-
- uses: actions/checkout@v4
61-
- uses: pkgxdev/dev@main
62-
- run: deno task typecheck
63-
64-
unit-tests:
65-
runs-on: ubuntu-latest
66-
steps:
67-
- uses: actions/checkout@v4
68-
- uses: pkgxdev/dev@main
69-
- run: deno test --allow-env --allow-net
70-
env:
71-
GITHUB_TOKEN: ${{ github.token }}
5+
cli:
6+
uses: ./.github/workflows/ci.cli.yml
7+
actions:
8+
uses: ./.github/workflows/ci.actions.yml

.github/workflows/shellcheck.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/.DS_Store
22
/deno.lock
3+
/.data

0 commit comments

Comments
 (0)