Files
releases/.github/workflows/pull-request.yaml
T
Stephan Renatus 30a06544f2 wasm: introduce abi_versions to capabilities (#3142)
* wasm: emit ABI version as global

This takes inspiration from the proxy-spec (Envoy's Wasm support).
There, it's recorded in an exported function's name. However, it's
been included like that in the spec because it's the least common
denominator among the different languages (potentially) used to
implement proxy-spec. We've got a pretty good grip on our generated
Wasm code, so we do what's noted in proxy-spec as "ideally, we'd do
xyz instead".

However, our ABI version is a simple integer, no semver.

Ref: https://github.com/proxy-wasm/spec/tree/master/abi-versions/vNEXT#proxy_abi_version_x_y_z

* ast.CapabilitiesForThisVersion: include WasmABIVersions

Extending the ast.Capabilities like this is somewhat unsatisfying -- the Wasm ABI has little to do with the ast package. However, moving Capabilities outside of ast in a way that's not introducing import cycles and is backwards-compatible proved to be quite an effort; so let's go with "simple" here.

* capatibilities.json: ensure it is generated with ABI versions

The build tag `generate` is what `go generate` would set, too. We're losing
that in the main.go -> gen-run-go.sh indirection, so we've got to set it
ourselves.

* ci: fix npm-opa-wasm e2e test

The CI build uses a version of OPA built in a previous step -- with the Wasm SDK _disabled_.
To still build Wasm modules, we thus fix the call to use the capabilities.json file from master,
which corresponds to the capabilities of a build of OPA with Wasm SDK enabled.

* docs/content/wasm.md: mention abi version, change headers

There is only one `#` header in a markdown document, so this fixes
that by adding a few `#`. I haven't added it everywhere below
`# Compiling`, but I think the structure is OK now.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-02-12 13:29:02 +01:00

114 lines
2.7 KiB
YAML

name: PR Check
on: [pull_request]
jobs:
# All jobs essentially re-create the `ci-release-test` make target, but are split
# up for parallel runners for faster PR feedback and a nicer UX.
go-build:
name: Go Build
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build Golang
run: make ci-go-build-all-platforms
timeout-minutes: 30
go-test:
name: Go Test
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Unit Test Golang
run: make ci-go-test-coverage
timeout-minutes: 30
go-perf:
name: Go Perf
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Benchmark Test Golang
run: make ci-go-perf
timeout-minutes: 30
go-lint:
name: Go Lint
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Golang Style and Lint Check
run: make ci-go-check
timeout-minutes: 30
wasm:
name: WASM
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build and Test WASM
run: make ci-wasm
timeout-minutes: 15
check-generated:
name: Check Generated
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Check Working Copy
run: make ci-check-working-copy
timeout-minutes: 15
wasm-go-sdk-e2e:
name: OPA Wasm SDK e2e
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build and Test Wasm SDK
run: make ci-go-wasm-sdk-e2e-test
timeout-minutes: 30
nodejs-wasm-example:
name: npm-opa-wasm
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build OPA
run: |
make ci-go-build-linux
ln -s _release/*/opa_linux_amd64 opa
echo $(pwd) >> $GITHUB_PATH
- name: Check out npm-opa-wasm
uses: actions/checkout@v2
with:
repository: open-policy-agent/npm-opa-wasm
path: npm-opa-wasm
# NOTE(sr): the opa binary built above doesn't have wasm enabled,
# so we override the capabilities for what the released binary
# provides.
- name: Run npm-opa-wasm nodejs-app examples
run: |
npm install
sed -i 's/opa build/opa build --capabilities=..\/..\/..\/capabilities.json/' examples/nodejs-ts-app/package.json
./e2e.sh
working-directory: npm-opa-wasm