Skip to content

Commit

Permalink
test: new job to test the XS worker (#1649)
Browse files Browse the repository at this point in the history
* test: new CI job to test the XS vat worker

This changes the "test swingset" CI job to additionally build the XS
toolkit (written in C), and then use that toolkit to compile the
`xs-vat-worker` program. The SwingSet unit tests will then exercise this
program (they skip the test unless the program is available).

To make the results more visible, another small step was added to run just
the one unit test that exercises `xs-vat-worker`.

The `git clone` steps were changed to include submodules, since the
xs-vat-worker package uses a git submodule to fetch our modified version of
the XS source tree.

refs #1299

* chore: rename xs-vat-worker Makefile

The original name came from the XS build tool convention, but required
annoying `-f` flags every time you use it, and we're only ever building for
linux/unix here.

* fix: xs-vat-worker/Makefile 'clean': there is no .bin/xs-vat-worker
  • Loading branch information
warner authored Oct 1, 2020
1 parent ecc0d7c commit 7ff75e1
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 132 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
node-version: ['12.14.1', '12.x', '14.x']
steps:
- uses: actions/checkout@v1
with:
submodules: 'true'
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
Expand Down Expand Up @@ -62,6 +64,8 @@ jobs:
path: .
key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }}
- uses: actions/checkout@v1
with:
submodules: 'true'
if: steps.built.outputs.cache-hit != 'true'
- name: yarn install
run: yarn install
Expand All @@ -70,6 +74,7 @@ jobs:
run: yarn build
if: steps.built.outputs.cache-hit != 'true'
# END-RESTORE-BOILERPLATE

- name: lint check
run: yarn lint-check

Expand All @@ -95,6 +100,8 @@ jobs:
path: .
key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }}
- uses: actions/checkout@v1
with:
submodules: 'true'
if: steps.built.outputs.cache-hit != 'true'
- name: yarn install
run: yarn install
Expand Down Expand Up @@ -252,6 +259,8 @@ jobs:
path: .
key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }}
- uses: actions/checkout@v1
with:
submodules: 'true'
if: steps.built.outputs.cache-hit != 'true'
- name: yarn install
run: yarn install
Expand All @@ -260,6 +269,7 @@ jobs:
run: yarn build
if: steps.built.outputs.cache-hit != 'true'
# END-RESTORE-BOILERPLATE

- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
Expand Down Expand Up @@ -296,6 +306,8 @@ jobs:
path: .
key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }}
- uses: actions/checkout@v1
with:
submodules: 'true'
if: steps.built.outputs.cache-hit != 'true'
- name: yarn install
run: yarn install
Expand All @@ -304,10 +316,23 @@ jobs:
run: yarn build
if: steps.built.outputs.cache-hit != 'true'
# END-RESTORE-BOILERPLATE

- name: install XS dependencies
working-directory: ./packages/xs-vat-worker
run: yarn install:xs-lin
- name: yarn build XS worker
working-directory: ./packages/xs-vat-worker
run: yarn build:xs-lin
- name: yarn test (SwingSet)
run: cd packages/SwingSet && yarn test
env:
ESM_DISABLE_CACHE: true
# explicitly test the XS worker, for visibility
- name: yarn test (SwingSet XS Worker)
working-directory: ./packages/SwingSet
run: yarn test:xs-worker
env:
ESM_DISABLE_CACHE: true

test-zoe:
# BEGIN-TEST-BOILERPLATE
Expand All @@ -329,6 +354,8 @@ jobs:
path: .
key: ${{ runner.os }}-${{ matrix.node-version }}-built-${{ github.sha }}
- uses: actions/checkout@v1
with:
submodules: 'true'
if: steps.built.outputs.cache-hit != 'true'
- name: yarn install
run: yarn install
Expand All @@ -337,6 +364,7 @@ jobs:
run: yarn build
if: steps.built.outputs.cache-hit != 'true'
# END-RESTORE-BOILERPLATE

- name: yarn test (zoe)
run: cd packages/zoe && yarn test
env:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"test": "yarn workspaces run test",
"build": "yarn workspaces run build",
"postinstall": "patch-package",
"patch-package": "patch-package"
"patch-package": "patch-package",
"build-xs-worker": "cd packages/xs-vat-worker && yarn build:xs-lin"
},
"dependencies": {
"patch-package": "^6.2.2"
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"scripts": {
"build": "exit 0",
"test": "ava",
"test:xs-worker": "ava test/workers/test-worker.js -m 'xs vat manager'",
"pretty-fix": "prettier --write '**/*.js'",
"pretty-check": "prettier --check '**/*.js'",
"lint-fix": "yarn lint --fix",
Expand Down
1 change: 1 addition & 0 deletions packages/xs-vat-worker/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.envrc
build/
compartmap.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ TOOLS=$(MODDABLE)/build/bin/lin/release/
NODE_MODULES=$(PWD)/node_modules
ROOT=$(PWD)/../..

.PHONY: all

all:
$(MAKE) build
@echo "### building XS tools (headless)"
$(MAKE) $(TOOLS)/mcconfig
@echo "### building compartmap.json"
$(MAKE) compartmap.json
cat compartmap.json
@echo "### building xs-worker"
$(MAKE) build/bin/lin/debug/xs-vat-worker


build/bin/lin/debug/xs-vat-worker: build $(TOOLS)/mcconfig moddable/xs/platforms/lin_xs_cli.c compartmap.json manifest.json
ROOT=$(ROOT) PATH=$(TOOLS):$$PATH MODDABLE=$(MODDABLE) mcconfig -o build -p x-cli-lin -m -d

Expand All @@ -20,14 +33,19 @@ moddable/xs/platforms/lin_xs_cli.c: moddable/xs/platforms/lin_xs.h

moddable/xs/platforms/lin_xs.h: /usr/include/glib-2.0/gio/gio.h

.PHONY: install-deps
install-deps:
$(MAKE) install-gio

.PHONY: install-gio
/usr/include/glib-2.0/gio/gio.h:
@echo "GIO not installed, need root to run apt-get install libgio2.0-dev
@echo "GIO not installed, need root to run apt-get install libglib2.0-dev"
@echo "feel free to stop now and run `make install-gio` directly, then rebuild"
$(MAKE) install-gio

# ubuntu 'bionic' puts gio in libglib2.0-dev
install-gio:
sudo apt-get -y update && sudo apt-get -y install libgio2.0-dev
sudo apt-get -y update && sudo apt-get -y install libglib2.0-dev

$(TOOLS)/mcconfig:
cd moddable && \
Expand All @@ -36,7 +54,7 @@ $(TOOLS)/mcconfig:
make headless

clean:
rm -rf build $(NODE_MODULES)/.bin/xs-vat-worker
rm -rf build

realclean:
rm -rf build
Expand Down
127 changes: 0 additions & 127 deletions packages/xs-vat-worker/compartmap.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/xs-vat-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "src/locate.js",
"module": "src/locate.js",
"scripts": {
"build:xs-lin": "make -f xs-lin.mk",
"install:xs-lin": "make install-deps",
"build:xs-lin": "make",
"test": "ava",
"build": "exit 0",
"lint-fix": "eslint --fix '**/*.{js,jsx}'",
Expand Down

0 comments on commit 7ff75e1

Please sign in to comment.