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

Feat/optional arch specific binaries #605

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YOU54F
Copy link
Member

@YOU54F YOU54F commented Jan 22, 2025

The following PR will fix #602

support libpact_ffi & pact-js-core node bindings to be published in seperate npm packages.

these are segmented by ${os}-{arch}-{libc}

users should not need to require these automatically, npm should determine the required
optional dependency to download at install time.

supported_platforms

"@pact-foundation/pact-core-darwin-arm64": "16.0.0",
"@pact-foundation/pact-core-darwin-x64": "16.0.0",
"@pact-foundation/pact-core-linux-arm64-glibc": "16.0.0",
"@pact-foundation/pact-core-linux-arm64-musl": "16.0.0",
"@pact-foundation/pact-core-linux-x64-glibc": "16.0.0",
"@pact-foundation/pact-core-linux-x64-musl": "16.0.0",
"@pact-foundation/pact-core-windows-x64": "16.0.0"

CI Improvements

Significant build time reductions, by reducing the times when prebuilds are created.

  • libpact_ffi node bindings as prebuilds will only be created on master
  • test suite will download the latest release prebuilds via gh cli, if not on a master branch

This could be further improved to

  • build node bindings & prebuilds, on pull requests, where
    • the libpact_ffi version has changed
    • the code in native or the bindings.gyp changes
  • allow top level job conditional skipping.
    • it appears you cannot skip an entire job based on a condition, which is a pre-requisite for another job, so you have to nested the condition at each step level.

Testing

Consumed in pact-js, via scoped publish, shown tested in following forked PR

Published for testing

"@you54f/pact": "14.0.1",
"@you54f/pact-core": "17.0.4",
"@you54f/pact-core-darwin-arm64": "17.0.4",
"@you54f/pact-core-darwin-x64": "17.0.4",
"@you54f/pact-core-linux-arm64-glibc": "17.0.4",
"@you54f/pact-core-linux-arm64-musl": "17.0.4",
"@you54f/pact-core-linux-x64-glibc": "17.0.4",
"@you54f/pact-core-linux-x64-musl": "17.0.4",
"@you54f/pact-core-windows-x64": "17.0.4",

Tested with

  • npm (works from node 16+)
  • yarn pnp (berry) - latest stable (works from node 18+)
  • pnpm (works from node 18+)
      matrix:
        node-version: [16, 18, 20, 22]
        npm_package_manager:
          - yarn
          - pnpm
          - npm
        os: [
            macos-13,
            macos-15,
            ubuntu-24.04,
            ubuntu-24.04-arm,
            windows-latest
          ]
        exclude:
          - npm_package_manager: yarn
            node-version: 16
          - npm_package_manager: pnpm
            node-version: 16

See example workflow / simple project

https://github.com/YOU54F/pact-js-packagers-test/blob/main/.github/workflows/test.yml

@YOU54F YOU54F force-pushed the feat/optional_arch_specific_binaries branch 3 times, most recently from 10e0f03 to 2ccfe78 Compare January 24, 2025 16:15
@YOU54F YOU54F marked this pull request as ready for review January 24, 2025 22:19
@YOU54F YOU54F force-pushed the feat/optional_arch_specific_binaries branch 2 times, most recently from cb4735d to 0793946 Compare January 28, 2025 19:02
support libpact_ffi & pact-js-core node bindings to be published in seperate npm packages.

these are segmented by os-arch-libc

users should not need to require these automatically, npm should determine the required
optional dependency to download at install time.

supported_platforms

    "@pact-foundation/pact-core-darwin-arm64": "16.0.0",
    "@pact-foundation/pact-core-darwin-x64": "16.0.0",
    "@pact-foundation/pact-core-linux-arm64-glibc": "16.0.0",
    "@pact-foundation/pact-core-linux-arm64-musl": "16.0.0",
    "@pact-foundation/pact-core-linux-x64-glibc": "16.0.0",
    "@pact-foundation/pact-core-linux-x64-musl": "16.0.0",
    "@pact-foundation/pact-core-windows-x64": "16.0.0"
@YOU54F YOU54F force-pushed the feat/optional_arch_specific_binaries branch from 0793946 to 809775e Compare January 28, 2025 19:09
@YOU54F YOU54F requested a review from mefellows January 28, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Optimization] Split prebuilds to OS specific packages
1 participant