Skip to content

Commit

Permalink
Node: added musl compiling action
Browse files Browse the repository at this point in the history
  • Loading branch information
ofirsnb committed Apr 10, 2024
1 parent 35b93db commit 0941f8b
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-node-wrapper/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ inputs:
- amazon-linux
- macos-latest
- ubuntu-latest
- ubuntu-latest-musl
named_os:
description: "The name of the current operating system"
required: false
default: "linux"
type: string
options:
- linux
- linux-musl
- darwin
arch:
description: "The current architecture"
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/install-shared-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ inputs:
options:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- x86_64-apple-darwin
- aarch64-apple-darwin
github-token:
Expand All @@ -35,7 +36,7 @@ runs:
brew upgrade || true
brew install git gcc pkgconfig openssl redis coreutils
- name: Install software dependencies for Ubuntu
- name: Install software dependencies for Ubuntu GNU
shell: bash
if: "${{ inputs.os == 'ubuntu-latest' }}"
run: |
Expand All @@ -48,12 +49,24 @@ runs:
run: |
yum install -y gcc pkgconfig openssl openssl-devel which curl redis6 gettext --allowerasing
- name: Install software dependencies for Ubuntu MUSL
shell: sh
if: "${{ inputs.os == 'ubuntu-latest-musl' }}"
run: |
apk update
wget -O - https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
apk add protobuf-dev musl-dev make gcc
- name: Install Rust toolchain
if: "${{ inputs.os != 'ubuntu-latest-musl' }}"
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ inputs.target }}

- name: Install protoc (protobuf)
if: "${{ inputs.os != 'ubuntu-latest-musl' }}"
uses: arduino/setup-protoc@v3
with:
version: "25.1"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/node-create-package-file/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ inputs:
- amazon-linux
- macos-latest
- ubuntu-latest
- ubuntu-latest-musl
named_os:
description: "The name of the current operating system"
required: false
default: "linux"
type: string
options:
- linux
- linux-musl
- darwin
arch:
description: "The current architecture"
Expand Down
46 changes: 41 additions & 5 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Install Redis Modules
uses: ./.github/workflows/install-redis-modules
with:
redis-version: ${{ matrix.redis }}
redis-version: ${{ matrix.redis }}

- name: test
run: npm test
Expand All @@ -73,17 +73,17 @@ jobs:
- name: test hybrid node modules - commonjs
run: |
npm install --package-lock-only
npm ci
npm ci
npm run build-and-test
working-directory: ./node/hybrid-node-tests/commonjs-test

- name: test hybrid node modules - ecma
run: |
npm install --package-lock-only
npm ci
npm run build-and-test
working-directory: ./node/hybrid-node-tests/ecmascript-test

- name: test redis modules
run: npm run test-modules -- --load-module=$GITHUB_WORKSPACE/redisjson.so
working-directory: ./node
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
yum -y remove git
yum -y remove git-*
yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum install -y git
yum install -y git
git --version
- uses: actions/checkout@v4
Expand Down Expand Up @@ -177,3 +177,39 @@ jobs:
- name: Test compatibility
run: npm test -- -t "set and get flow works"
working-directory: ./node


build-linux-musl-latest:
runs-on: ubuntu-latest
container:
image: node:18.19.0-alpine
timeout-minutes: 15
steps:
- name: Install git
run: apk add git

- uses: actions/checkout@v4

- name: Checkout submodules
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git submodule update --init --recursive
- name: Build Node wrapper
uses: ./.github/workflows/build-node-wrapper
with:
os: "ubuntu-latest-musl"
target: "aarch64-unknown-linux-musl"
github-token: ${{ secrets.GITHUB_TOKEN }}
arch: "arm64"
named_os: "linux-musl"

- name: Create a symbolic Link for redis6 binaries
working-directory: ./node
run: |
ln -s /usr/bin/redis6-server /usr/bin/redis-server
ln -s /usr/bin/redis6-cli /usr/bin/redis-cli
- name: Test compatibility
run: npm test -- -t "set and get flow works"
working-directory: ./node
15 changes: 13 additions & 2 deletions .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
if: github.repository_owner == 'aws'
name: Publish packages to NPM
runs-on: ${{ matrix.build.RUNNER }}
container:
image: ${{ matrix.build.IMAGE }}
strategy:
fail-fast: false
matrix:
Expand All @@ -54,6 +56,14 @@ jobs:
TARGET: aarch64-unknown-linux-gnu,
CONTAINER: "2_28",
}
- {
OS: ubuntu-latest-musl,
NAMED_OS: linux-musl,
RUNNER: ubuntu-latest,
ARCH: arm64,
TARGET: aarch64-unknown-linux-musl,
IMAGE: "node:18.19.0-alpine",
}
- {
OS: macos-latest,
NAMED_OS: darwin,
Expand Down Expand Up @@ -85,6 +95,7 @@ jobs:
echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV
- name: Setup node
if: "${{ matrix.build.OS != 'ubuntu-latest-musl' }}"
uses: actions/setup-node@v3
with:
node-version: "16"
Expand All @@ -93,13 +104,13 @@ jobs:
scope: "${{ vars.NPM_SCOPE }}"
always-auth: true
token: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Update package version in config.toml
uses: ./.github/workflows/update-glide-version
with:
folder_path: "${{ github.workspace }}/node/rust-client/.cargo"
named_os: ${{ matrix.build.NAMED_OS }}

- name: Build Node wrapper
uses: ./.github/workflows/build-node-wrapper
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update-glide-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ inputs:
type: string
options:
- linux
- linux-musl
- darwin
runs:
using: "composite"
Expand Down

0 comments on commit 0941f8b

Please sign in to comment.