Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up GitHub Actions CI for JavaScript #7

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .github/checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
de8f480bdc7f0d19863c54b0d42c47eed7db1bde6aeabccdca0327d99eef6f3b *kaitai-struct-compiler_0.9_all.deb
40 changes: 40 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install ksc
run: |
sudo apt-get update
curl -fsSL -O https://github.com/kaitai-io/kaitai_struct_compiler/releases/download/0.9/kaitai-struct-compiler_0.9_all.deb
sha256sum --check --warn .github/checksums
sudo apt-get install ./kaitai-struct-compiler_0.9_all.deb
ksc --version
- name: Compile ksy to target languages
working-directory: _test
run: ./compile-ksy
- name: Initialize npm
working-directory: javascript
run: npm install
- name: Run tests
working-directory: _test
run: ./run-javascript
10 changes: 8 additions & 2 deletions _test/compile-ksy
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/bin/sh
#!/bin/sh -e

ksc -t all --outdir=compiled ksy/*.ksy
ksc \
--verbose=file \
-t javascript \
-t python\
-t ruby \
--outdir=compiled \
ksy/*.ksy
Comment on lines +3 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal preference would be to always use space as a parameter name/value separator, as ksc --help suggests:

$ ksc --help
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding="UTF-8"
kaitai-struct-compiler 0.10-SNAPSHOT
Usage: kaitai-struct-compiler [options] <file>...

  <file>...                source files (.ksy)
  -t, --target <language>  target languages (graphviz, csharp, rust, all, perl, java, go, cpp_stl, php, lua, python, nim, html, ruby, construct, javascript)
  -d, --outdir <directory>
                           output directory (filenames will be auto-generated)
  (...)
  --verbose <value>        verbose output

Note that it's written as --verbose <value>, not --verbose=<value>.

Suggested change
ksc \
--verbose=file \
-t javascript \
-t python\
-t ruby \
--outdir=compiled \
ksy/*.ksy
ksc \
--verbose file \
-t javascript \
-t python\
-t ruby \
--outdir compiled \
ksy/*.ksy

Sorry for nitpicking.

2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"devDependencies": {
"kaitai-struct": "next",
"mocha": "^5"
"mocha": "^9.0.3"
},
"repository": {
"type": "git",
Expand Down