Skip to content

Commit 3890d89

Browse files
committed
Fix GitHub Actions
1 parent fe95cf7 commit 3890d89

File tree

3 files changed

+47
-29
lines changed

3 files changed

+47
-29
lines changed

.github/workflows/test.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,38 @@ jobs:
2020

2121
steps:
2222
- uses: actions/checkout@v2
23-
- name: Install Node.js 13
24-
uses: actions/setup-node@v1
25-
env:
26-
RUNNER_TEMP: /tmp
27-
with:
28-
node-version: "13.x"
29-
- run: apt update
30-
- name: install utilities
23+
- run: sudo apt update
24+
- name: Install utilities
3125
run:
32-
apt install -y automake build-essential git pkg-config python
26+
sudo apt install -y automake build-essential git pkg-config python
3327
python-pip unzip
3428
- name: Setup emsdk (use cache if found, create otherwise)
3529
uses: mymindstorm/setup-emsdk@v2
3630
with:
3731
version: 1.39.12
32+
- name: Install Node.js 13
33+
uses: actions/setup-node@v1
34+
env:
35+
RUNNER_TEMP: /tmp
36+
with:
37+
node-version: "13.x"
3838
- name: Setup Deno latest
39-
run: curl -fsSL https://deno.land/x/install/install.sh | sh
40-
- name: download deps
39+
run:
40+
curl -fsSL https://deno.land/x/install/install.sh | sudo
41+
DENO_INSTALL=/usr/local sh
42+
- name: Download and build dependencies
4143
run: make deps
4244
env:
4345
CI: true
44-
- name: tests
46+
- name: Build and pack Viz.js
47+
run: make pack -j4
48+
env:
49+
VIZ_VERSION: unreleased-${{ github.sha }}
50+
- name: Run tests
4551
run: make test -j4
52+
- name: Upload artifact if tests are green
53+
if: success()
54+
uses: actions/upload-artifact@v1
55+
with:
56+
name: viz.js-unreleased-${{ github.sha }}.tar.gz
57+
path: sources/viz.js-vunreleased-${{ github.sha }}.tar.gz

Makefile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ PREFIX_FULL = $(abspath ./prefix-full)
22
PREFIX_LITE = $(abspath ./prefix-lite)
33
DIST_FOLDER = $(abspath ./dist)
44

5-
VIZ_VERSION ?= $(shell node -p "require('./package.json').version")
5+
NODE ?= node
6+
7+
VIZ_VERSION ?= $(shell $(NODE) -p "require('./package.json').version")-$(shell git rev-parse HEAD)
68
EXPAT_VERSION = 2.2.9
79
GRAPHVIZ_VERSION = 2.44.0
810
EMSCRIPTEN_VERSION = 1.39.12
@@ -18,9 +20,9 @@ CC = $(EMCC)
1820
CC_FLAGS = --bind -s ALLOW_MEMORY_GROWTH=1 -s DYNAMIC_EXECUTION=0 -s ENVIRONMENT=node,worker --closure 0 -g1
1921
CC_INCLUDES = -I$(PREFIX_FULL)/include -I$(PREFIX_FULL)/include/graphviz -L$(PREFIX_FULL)/lib -L$(PREFIX_FULL)/lib/graphviz -lgvplugin_core -lgvplugin_dot_layout -lgvplugin_neato_layout -lcgraph -lgvc -lgvpr -lpathplan -lexpat -lxdot -lcdt
2022

21-
YARN_PATH = $(shell awk '{ if($$1 == "yarnPath:") print $$2; }' .yarnrc.yml)
23+
YARN_PATH = $(shell $(NODE) -p 'path.resolve($(shell awk '{ if($$1 == "yarnPath:") print $$2; }' .yarnrc.yml))')
2224
YARN_DIR = $(shell dirname $(YARN_PATH))
23-
YARN ?= node $(YARN_PATH)
25+
YARN ?= $(NODE) $(YARN_PATH)
2426

2527
TSC ?= $(YARN) tsc
2628
TS_FLAGS = --lib esnext,WebWorker
@@ -65,13 +67,17 @@ test: all
6567
deno-test: test/deno-files/render.wasm.arraybuffer.js test/deno-files/index.d.ts
6668
$(DENO) --importmap test/deno-files/importmap.json test/deno.ts
6769

70+
.PHONY: pack
71+
pack: all
72+
$(YARN) pack -o sources/viz.js-v$(VIZ_VERSION).tar.gz
73+
6874
.PHONY: publish
6975
publish:
7076
npm version $(VIZ_VERSION)
7177
$(MAKE) clean
7278
$(MAKE) test -j4 || (git reset HEAD^ --hard && git tag -d v$(VIZ_VERSION) && exit 1)
73-
$(YARN) pack -o sources/viz.js-v$(VIZ_VERSION).tar.gz
74-
npm publish --access public
79+
$(MAKE) pack
80+
$(YARN) npm publish --access public
7581
git push && git push --tags
7682

7783
.PHONY: debug
@@ -90,7 +96,6 @@ clean:
9096
rm -rf build dist
9197
rm -f wasm worker
9298
rm -f test/deno-files/render.wasm.uint8.js test/deno-files/index.d.ts
93-
mkdir build dist
9499

95100
.PHONY: clobber
96101
clobber: | clean
@@ -99,11 +104,11 @@ clobber: | clean
99104
wasm worker:
100105
echo "throw new Error('The bundler you are using does not support package.json#exports.')" > $@
101106

102-
build/worker.js: src/worker.ts
103-
$(TSC) $(TS_FLAGS) --outDir build -m es6 --target esnext $^
107+
build/worker.js: src/worker.ts build
108+
$(TSC) $(TS_FLAGS) --outDir build -m es6 --target esnext $<
104109

105-
build/index.js: src/index.ts
106-
$(TSC) $(TS_FLAGS) --outDir build -m es6 --target esnext $^
110+
build/index.js: src/index.ts build
111+
$(TSC) $(TS_FLAGS) --outDir build -m es6 --target esnext $<
107112

108113
dist/index.d.ts: src/index.ts
109114
$(TSC) $(TS_FLAGS) --outDir $(DIST_FOLDER) -d --emitDeclarationOnly $^
@@ -161,7 +166,7 @@ build/render.wasm: build/render.js
161166
dist/render.wasm: build/render.wasm
162167
cp $< $@
163168

164-
build/render.js: src/viz.cpp
169+
build/render.js: src/viz.cpp build
165170
$(CC) --version | grep $(EMSCRIPTEN_VERSION)
166171
$(CC) $(CC_FLAGS) -Oz -o $@ $< $(CC_INCLUDES)
167172

@@ -170,7 +175,7 @@ test/deno-files/render.wasm.arraybuffer.js: dist/render.wasm
170175
hexdump -v -x $< | awk '$$1=" "' OFS=",0x" >> $@ && \
171176
echo "]).buffer.slice(2$(shell stat -f%z $< | awk '{if (int($$1) % 2) print ",-1"}'))" >> $@
172177

173-
$(PREFIX_FULL) dist sources $(YARN_DIR):
178+
$(PREFIX_FULL) build dist sources $(YARN_DIR):
174179
mkdir -p $@
175180

176181
.PHONY: expat–full

test/browser.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ describe("Test graph rendering using web browser", function() {
2222
*/
2323
let page;
2424

25-
before(() =>
26-
Promise.all([
27-
import("./web-server/bootstrap.mjs").then(module => {
25+
before(function () {
26+
this.timeout(18000);
27+
return Promise.all([
28+
import("./web-server/bootstrap.mjs").then((module) => {
2829
server = module.default();
2930
}),
3031
puppeteer.launch(PUPPETEER_OPTIONS).then(b => {
3132
browser = b;
3233
}),
33-
])
34-
);
34+
]);
35+
});
3536

3637
after(() => Promise.all([server.close(), browser.close()]));
3738

0 commit comments

Comments
 (0)