Pact-Js-Core uses FFI bindings from the pact-reference project, which are prebuilt for end users, the following steps will show some of the steps required to build and test locally on your machine.
Do this and you should be 👌👌👌:
bash script/ci/prebuild.sh
npm ci --ignore-scripts
npm run build
npm test
notes -
As a developer, you need to run bash script/ci/prebuild.sh
to
- download the FFI libraries to
ffi
folder - prebuilds the binaries and outputs to
prebuilds
- cleans up
ffi
andbuild
For end users, the following is provided as part of the packaging and release step in CI.
- the
prebuilds
folder containing builtffi
bindings - the
binding.gyp
file is removed from the npm package, sonpm install
doesn't attempt to build theffi
buildings, that are prebuilt.
If you have a binding.gyp
file, and have created prebuilds
you will want to perform npm ci
or npm install
with --ignore-scripts
set, to avoid building the ffi
which is prebuilt.
Alternatively you can run the following, which will not create a prebuild, but instead use node-gyp
to output the built ffi
libraries to the build
folder. This was the previous method, which meant that end users would also perform.
bash script/download-libs.sh
npm ci
npm run build
npm test
#### Pre Reqs
- x86_64 Machine
- ARM64 Mac - If you have Rosetta (MacOS)
- Docker/Podman
- Act
act --container-architecture linux/amd64 -W .github/workflows/build-and-test.yml --artifact-server-path tmp
#### Pre Reqs
- Arm64 Mac
- Cirrus-Cli
- Tart.run
cirrus run --output github-actions macos_arm --artifacts-dir tmp
#### Pre Reqs
- Arm64 Machine
- Arm64 Machine
- Docker / Podman
- Cirrus-Cli
cirrus run --output github-actions linux_arm --artifacts-dir tmp
#### Publishing Assets
MacOS ARM64
cirrus run --output github-actions macos_arm --artifacts-dir tmp --environment GITHUB_TOKEN=$GITHUB_TOKEN --environment CIRRUS_RELEASE=test --environment CIRRUS_REPO_FULL_NAME=pact-foundation/pact-js-core;
Linux ARM64
cirrus run --output github-actions linux_arm --artifacts-dir tmp --environment GITHUB_TOKEN=$GITHUB_TOKEN --environment CIRRUS_RELEASE=test --environment CIRRUS_REPO_FULL_NAME=pact-foundation/pact-js-core;