Skip to content

Commit

Permalink
test: new CI job to test the XS vat worker
Browse files Browse the repository at this point in the history
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
  • Loading branch information
warner committed Oct 1, 2020
1 parent a077819 commit 576628a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 131 deletions.
24 changes: 24 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 Down Expand Up @@ -95,6 +99,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 +258,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 @@ -296,18 +304,32 @@ 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
if: steps.built.outputs.cache-hit != 'true'
- name: install XS dependencies
working-directory: ./packages/xs-vat-worker
run: yarn install:xs-lin
- name: yarn build
run: yarn build
if: steps.built.outputs.cache-hit != 'true'
- name: yarn build-xs-worker
working-directory: ./packages/xs-vat-worker
run: yarn build:xs-lin
# END-RESTORE-BOILERPLATE
- 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 +351,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
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
127 changes: 0 additions & 127 deletions packages/xs-vat-worker/compartmap.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/xs-vat-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "src/locate.js",
"module": "src/locate.js",
"scripts": {
"install:xs-lin": "make -f xs-lin.mk install-deps",
"build:xs-lin": "make -f xs-lin.mk",
"test": "ava",
"build": "exit 0",
Expand Down
24 changes: 21 additions & 3 deletions packages/xs-vat-worker/xs-lin.mk
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) -f xs-lin.mk build
@echo "### building XS tools (headless)"
$(MAKE) -f xs-lin.mk $(TOOLS)/mcconfig
@echo "### building compartmap.json"
$(MAKE) -f xs-lin.mk compartmap.json
cat compartmap.json
@echo "### building xs-worker"
ROOT=$(ROOT) PATH=$(TOOLS):$$PATH MODDABLE=$(MODDABLE) mcconfig -o build -p x-cli-lin -m -d


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) -f xs-lin.mk 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 libgio2.0-dev"
@echo "feel free to stop now and run `make install-gio` directly, then rebuild"
$(MAKE) install-gio
$(MAKE) -f xs-lin.mk 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 Down

0 comments on commit 576628a

Please sign in to comment.