Skip to content
Merged

V1 #210

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/ci.actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
on:
pull_request:
workflow_call:

env:
# FIXME
# we must set this or pkgx won’t find the main pantry after $HOME is changed
# because the default is based on $HOME and we don’t sync if $PKGX_PANTRY_PATH is set
# FIXME add PKGX_HOME to libpkgx
XDG_DATA_HOME: ${{github.workspace}}/.data

jobs:
build:
runs-on: ${{ matrix.platform.os }}
outputs:
pkgspec: ${{ steps.build.outputs.pkgspec }}
env:
PKGX_PANTRY_PATH: ${{github.workspace}}/co
strategy:
matrix:
platform:
- os: ubuntu-latest
name: linux
- os: macos-latest
name: darwin
steps:
- uses: actions/checkout@v4
with:
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR

- uses: pkgxdev/setup@v2

- uses: ./co/build
id: build
with:
pkg: stark.com/foo

- run: test ${{ steps.build.outputs.pkgspec }} = stark.com/foo=2.3.4
- run: test ${{ steps.build.outputs.project }} = stark.com/foo
- run: test ${{ steps.build.outputs.version }} = 2.3.4
- run: test ${{ steps.build.outputs.platform }} = ${{ matrix.platform.name }}
- run: test ${{ steps.build.outputs.arch }} = x86-64
- run: test -d ${{ steps.build.outputs.prefix }}
- run: test $BREWKIT_PKGSPEC = ${{ steps.build.outputs.pkgspec }}
- run: test $BREWKIT_PREFIX = ${{ steps.build.outputs.prefix }}

- uses: ./co/upload-build-artifact

test:
needs: build
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
env:
PKGX_PANTRY_PATH: ${{github.workspace}}/co
steps:
- uses: actions/checkout@v4
with:
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
- uses: pkgxdev/setup@v2
- uses: ./co/download-build-artifact
- uses: ./co/test
with:
pkg: ${{ needs.build.outputs.pkgspec }}

audit:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
env:
PKGX_PANTRY_PATH: ${{github.workspace}}/co
steps:
- uses: actions/checkout@v4
with:
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR
- uses: pkgxdev/setup@v2
- uses: ./co/download-build-artifact
- uses: ./co/audit
with:
pkg: ${{ needs.build.outputs.pkgspec }}

bottle:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
compression: [xz, gz]
platform:
- darwin+x86-64
- linux+x86-64
steps:
- uses: actions/checkout@v4
with:
path: co # test that things working isn’t just a coincident of PWD == BREKWIT_DIR

- uses: pkgxdev/setup@v2

- uses: ./co/download-build-artifact
id: dl
with:
extract: false
platform: ${{ matrix.platform }}

- uses: ./co/bottle
id: bottle
with:
file: ${{ steps.dl.outputs.filename }}
compression: ${{matrix.compression}}

- uses: actions/upload-artifact@v3
with:
path: ${{ steps.bottle.outputs.filename }}
name: ${{ steps.bottle.outputs.name }}

unavailable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/setup@v2

- uses: ./build
id: build
with:
pkg: unavailable.com
env:
PKGX_PANTRY_PATH: ${{github.workspace}}

- run: echo ${{steps.build.outputs.noop}}

- run: exit 1
if: ${{steps.build.outputs.noop != 'true'}}
84 changes: 84 additions & 0 deletions .github/workflows/ci.cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
on:
pull_request:
workflow_call:

env:
GITHUB_TOKEN: ${{github.token}}
PKGX_PANTRY_PATH: ${{github.workspace}}
# FIXME
# we must set this or pkgx won’t find the main pantry after $HOME is changed
# because the default is based on $HOME and we don’t sync if $PKGX_PANTRY_PATH is set
# FIXME add PKGX_HOME to libpkgx
XDG_DATA_HOME: ${{github.workspace}}/.data

jobs:
integration-tests:
name: ${{matrix.pkg}} (${{matrix.platform.tag}})
strategy:
matrix:
platform:
- os: ubuntu-latest
img: debian:buster-slim
tag: linux
- os: macos-latest
tag: mac
pkg:
- stark.com/foo
- toolchain.com
- pyapp.com/1
- pyapp.com/2
- stark.com/[email protected]
runs-on: ${{ matrix.platform.os }}
container: ${{ matrix.platform.img }}
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/setup@v2

- name: precache # makes it easier to read the real output
run: | # we have to make symlinks because deno cache doesn’t take a --ext=ts flag
ln -s bin/cmd/build build.ts
ln -s bin/cmd/test test.ts
pkgx deno cache *.ts
rm *.ts

- run: bin/bk build ${{matrix.pkg}}
- run: bin/bk test ${{matrix.pkg}}
- run: bin/bk audit ${{matrix.pkg}}

local-edit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/setup@v2
- run: pkgx --sync #FIXME bug where shebangs don’t cause an auto-sync
- uses: fregante/setup-git-user@v2
- run: git update-ref refs/remotes/origin/main HEAD
- run: '! bin/bk status'
- run: cp package-mod.yml package.yml
working-directory: projects/stark.com/foo
- run: test $(bin/bk status) = stark.com/foo
- run: bin/bk build
- run: bin/bk test
- run: test $(pkgx +stark.com/foo -- stark) = not_much_u
- run: bin/bk audit

unit-tests:
runs-on: ubuntu-latest
env:
PKGX_PANTRY_PATH: null
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/dev@main
- run: deno test --allow-env --allow-net --ignore=.data

unavailable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/setup@v2
- run: pkgx --sync # FIXME PKGX_PANTRY_PATH causes auto sync to fail
- name: build
run: |
set +e
bin/bk build unavailable.com
test $? -eq 2
71 changes: 4 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,8 @@
on:
pull_request:
workflow_dispatch:

jobs:
integration-tests:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
strategy:
fail-fast: false
matrix:
pkgs:
- zlib.net
- openssl.org^1.1 curl.se/ca-certs
- pipenv.pypa.io
- poppler.freedesktop.org/poppler-data
- catb.org/wumpus
- c-ares.org
- vim.org
- curl.se
# FIXME? requires a darwin platform to run, and needs
# macOS 12 to test. That'll require a more complex matrix
# using get-platform.
# - github.com/realm/SwiftLint
container:
image: debian:buster-slim
steps:
- uses: actions/checkout@v4
- uses: ./actions/setup-brewkit

# prefetch deno deps to make the output from the build step more legible
- run: pkgx deno cache **/*.ts

- run: pkg build ${{matrix.pkgs}}
id: build

- run: test -n '${{ steps.build.outputs.pkgs }}'
- run: test -n '${{ steps.build.outputs.relative-paths }}'

- run: |
if pkg query ${{ steps.build.outputs.pkgs }} --src 2>&1 | grep -E '^warn: pkg has no srcs:'; then
echo "srcs=false" >> $GITHUB_OUTPUT
else
echo "srcs=true" >> $GITHUB_OUTPUT
fi
id: srcs

- run: test -n '${{ steps.build.outputs.srcs }}'
if: steps.srcs.outputs.srcs == 'true'

- run: test -n '${{ steps.build.outputs.srcs-relative-paths }}'
if: steps.srcs.outputs.srcs == 'true'

- run: pkg test ${{matrix.pkgs}}

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/dev@main
- run: deno task typecheck

unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pkgxdev/dev@main
- run: deno test --allow-env --allow-net
env:
GITHUB_TOKEN: ${{ github.token }}
cli:
uses: ./.github/workflows/ci.cli.yml
actions:
uses: ./.github/workflows/ci.actions.yml
13 changes: 0 additions & 13 deletions .github/workflows/shellcheck.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.DS_Store
/deno.lock
/.data
Loading