8000 Unify js flavors by tomsfernandez · Pull Request #160 · aml-org/amf-custom-validator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Unify js flavors #160

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

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ vendor/
# Don't store the wasm code
wrappers/js/lib/main.wasm
wrappers/js/lib/main.wasm.gz
wrappers/js-web/lib/main.wasm.gz
wrappers/js-web/dist/**

# Don't store node moudles
wrappers/js/dist
wrappers/js/node_modules
wrappers/js-web/node_modules
wrappers/js-web/test/out
wrappers/js/test/browser/out

amf.jar
acv

Expand Down
23 changes: 4 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,14 @@ RUN apt-get update && apt-get install make
# Install
RUN make ci-java

FROM node:16 AS ci-js

# First copy dependencies to enable Docker caching them
FROM cypress/included:11.2.0 as ci-js
COPY . ./src
WORKDIR ./src/wrappers/js
RUN npm install

# JS-WEB
WORKDIR ../js-web
RUN npm install

WORKDIR ../js

# Copy generated WASM
COPY --from=ci-go /go/src/wrappers/js/lib/main.wasm.gz ./lib

WORKDIR ../../
RUN make ci-js

FROM cypress/included:11.2.0 as ci-browser
COPY --from=ci-js /src ./src
WORKDIR ./src
RUN ./scripts/ci-browser.sh
RUN npm install
RUN npm run build
RUN npm test

FROM ci-go AS go-coverage
RUN make go-coverage
Expand Down
22 changes: 2 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@ pipeline {
echo "Success" // Tests are actually run when building the agent in the Dockerfile
}
}
stage('Test generated WASM (JS Browser)') {
agent {
dockerfile {
filename 'Dockerfile'
additionalBuildArgs '--target ci-browser'
registryCredentialsId 'dockerhub-pro-credentials'
}
}
steps {
echo "Success" // Tests are actually run when building the agent in the Dockerfile
}
}
stage('Coverage') {
agent {
dockerfile {
Expand Down Expand Up @@ -151,19 +139,13 @@ pipeline {
npm-snapshot $BUILD_NUMBER
fi
VERSION=$(node -pe "require('./package.json').version")
npm publish --access public

cd ../js-web
if [ "$IS_SNAPSHOT" = true ]; then
npm-snapshot $BUILD_NUMBER
fi
npm install
npm run build
npm publish --access public

if [ "$IS_SNAPSHOT" = true ]; then
npm dist-tag add @aml-org/amf-custom-validator-web@${VERSION} snapshot
npm dist-tag add @aml-org/amf-custom-validator@${VERSION} snapshot
else
npm dist-tag add @aml-org/amf-custom-validator-web@${VERSION} release
npm dist-tag add @aml-org/amf-custom-validator@${VERSION} release
fi

Expand Down
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ go-coverage:

# must run build-js first
test-js:
cd ./wrappers/js && npm install && npm test
cd ./wrappers/js && npm install && npm run build && npm test

# must have a downloaded AMF CLI
test-profiles:
Expand All @@ -36,22 +36,18 @@ build-native:
go build -o acv ./cmd/main.go

build-js:
./scripts/gen_js_package.sh
GOOS=js GOARCH=wasm go build -o wrappers/js/lib/main.wasm -ldflags "-s -w" js/validator.go &&\
gzip -9 -v -c wrappers/js/lib/main.wasm > wrappers/js/lib/main.wasm.gz &&\
rm wrappers/js/lib/main.wasm

build-js-web: build-js bundle-web-js

bundle-web-js:
./scripts/bundle_js_web_package.sh

## CI =====================================================================================

ci-go: test-go build-native build-js

ci-js: test-js

ci-browser:
./scripts/ci-browser.sh

ci-java:
./scripts/download-amf-cli.sh
./scripts/validate-profiles.sh
Expand Down
4 changes: 0 additions & 4 deletions scripts/bundle_js_web_package.sh

This file was deleted.

5 changes: 0 additions & 5 deletions scripts/ci-browser-local.sh

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/ci-browser.sh

This file was deleted.

4 changes: 0 additions & 4 deletions scripts/gen_js_package.sh

This file was deleted.

75 changes: 0 additions & 75 deletions wrappers/js-web/index.js

This file was deleted.

Loading
0