Skip to content

Commit

Permalink
Merge pull request #36 from aerospike/stage
Browse files Browse the repository at this point in the history
RC 1.0.2
  • Loading branch information
khaf authored May 1, 2024
2 parents eb72148 + eda9676 commit 79e98a0
Show file tree
Hide file tree
Showing 10 changed files with 350 additions and 14,982 deletions.
137 changes: 91 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,96 @@
name: Build and Test

on:
push:
branches:
- php-rs

on:
push:
branches: main
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
- name: Install PHP Build Dependencies
run: |
sudo apt-get update
sudo apt-get install -y autoconf2.13 bison2.7 libbison-dev libcurl4-openssl-dev libssl-dev libxml2-dev libjpeg-dev libpng-dev libicu-dev libmcrypt-dev libreadline-dev libfreetype6-dev libzip-dev
build-php-client:
runs-on: ubuntu-latest
container: golang:latest
steps:
- name: Check Go Version
run: |
go version
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOPATH/bin:/usr/local/go/bin
- name: Install Go Dependencies
run: |
apt-get update
apt-get install -y protobuf-compiler
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
- name: Stable with rustfmt and clippy
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy

- name: Clone the php-src repository
run: |
git clone https://github.com/php/php-src.git
cd php-src
git checkout PHP-8.1
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
rustc --version
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Check php Version
run: |
php --version
- name: Install other dependencies
run: |
apt-get install -y clang
export LIBCLANG_PATH="/usr/lib/llvm-14/lib/"
apt-get install -y php-dev
apt-get install -y rpm
- name: Checkout aerospike php client
uses: actions/checkout@v4
with:
repository: 'aerospike/php-client'
ref: 'CLIENT-2836-pkg'
- name: Build Aerospike connection manager
run: |
git config --global --add safe.directory '*'
cd aerospike-connection-manager
make clean
make proto
make build
- name: Build aerospike php client library
run: |
ls
cargo build --release
- name: Package for deb
run: |
mkdir -p pkg/deb/aerospike-php-client-deb
mkdir -p pkg/deb/aerospike-php-client-deb/DEBIAN
mkdir -p pkg/deb/aerospike-php-client-deb/etc
mkdir -p pkg/deb/aerospike-php-client-deb/usr/bin
mkdir -p pkg/deb/aerospike-php-client-deb/usr/lib
- name: Build and Install PHP
run: |
cd php-src
./buildconf
PREFIX="${HOME}/build/php"
./configure --prefix="${PREFIX}" \
--enable-debug \
--disable-all --disable-cgi
make -j "$(nproc)"
make install
echo "${PREFIX}/bin" >> $GITHUB_PATH
cp aerospike-connection-manager/asld pkg/deb/aerospike-php-client-deb/usr/bin
cp aerospike-connection-manager/asld.toml pkg/deb/aerospike-php-client-deb/etc
cp target/release/libaerospike_php.so pkg/deb/aerospike-php-client-deb/usr/lib
cp pkg/deb/control pkg/deb/aerospike-php-client-deb/DEBIAN/
cp pkg/deb/scripts/postinst pkg/deb/aerospike-php-client-deb/DEBIAN/
dpkg-deb --build pkg/deb/aerospike-php-client-deb
cp pkg/deb/aerospike-php-client-deb.deb pkg/deb/aerospike-php-client-1.0.2-x86_64.deb
cp pkg/deb/aerospike-php-client-deb.deb pkg/deb/aerospike-php-client-1.0.2-aarch64.deb
ls pkg/deb/
rm -rf pkg/deb/aerospike-php-client-deb*
- name: Move DEB x86_64 to artifacts
uses: actions/upload-artifact@v2
with:
name: aerospike-php-client-deb-x86_64
path: pkg/deb/aerospike-php-client-1.0.2-x86_64.deb

- name: Move DEB aarch64 to artifacts
uses: actions/upload-artifact@v2
with:
name: aerospike-php-client-deb-aarch64
path: pkg/deb/aerospike-php-client-1.0.2-aarch64.deb

- name: Verify Installed PHP Version
run: |
${HOME}/build/php/bin/php -v



- name: Run 'make' command
run: |
make
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ifeq ($(UNAME_S),Darwin)
else ifeq ($(UNAME_S),Linux)
EXTENSION := .so
PHP_VERSION := $(shell php -i | grep -Po '(?<=PHP Version => ).*' | uniq)
RESTART_COMMAND := sudo systemctl restart php$(PHP_VERSION)-fpm && sudo systemctl restart apache2
RESTART_COMMAND := systemctl restart php$(PHP_VERSION)-fpm && systemctl restart apache2
else
$(error Unsupported operating system: $(UNAME_S))
endif
Expand All @@ -23,7 +23,7 @@ ifeq ($(shell awk 'BEGIN{ print ("$(PHP_VERSION)" >= "8.0") }'), 0)
endif

.PHONY: build install test clean
all: lint build install test clean
all: lint build install clean

lint:
cargo clippy
Expand All @@ -35,21 +35,22 @@ build:
cargo build --release

install-dev: build-dev
sudo cp -f target/debug/libaerospike_php$(EXTENSION) $(EXT_DIR_PATH)
echo "extension=libaerospike_php$(EXTENSION)" | sudo tee -a $(PHP_INI_PATH)
cp -f target/debug/libaerospike_php$(EXTENSION) $(EXT_DIR_PATH)
echo "extension=libaerospike_php$(EXTENSION)" | tee -a $(PHP_INI_PATH)

install: build
sudo cp -f target/release/libaerospike_php$(EXTENSION) $(EXT_DIR_PATH)
echo "extension=libaerospike_php$(EXTENSION)" | sudo tee -a $(PHP_INI_PATH)
cp -f target/release/libaerospike_php$(EXTENSION) $(EXT_DIR_PATH)
echo "extension=libaerospike_php$(EXTENSION)" | tee -a $(PHP_INI_PATH)

restart: install
$(RESTART_COMMAND)

test-dev: install-dev
sudo ./vendor/phpunit/phpunit/phpunit tests/
./vendor/phpunit/phpunit/phpunit tests/

test: install
phpunit tests/
@which phpunit > /dev/null || (echo "PHPUnit is not installed. Please install PHPUnit before running tests." && exit 1)
phpunit tests/

clean:
cargo clean
6 changes: 3 additions & 3 deletions aerospike-connection-manager/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GOCMD=go
VERSION=$(shell git describe --tags --abbrev=0 | cut -c 2-)
GOBUILD=$(GOCMD) build -ldflags="-X 'main.version=$(VERSION)'" -o asld
GOBUILD=$(GOCMD) build -ldflags="-X 'main.version=$(VERSION)'" -o asld
GOGET=$(GOCMD) get -u
BINARY_NAME=asld
SERVICE_NAME=asld
SERVICE_NAME=aerospike-connection-manager.service

.PHONY: test test-rest lint lint-insane clean docs deps modtidy check
all: run
Expand All @@ -24,7 +24,7 @@ build:
$(GOBUILD) .

run: clean proto
$(GOBUILD) -o $(BINARY_NAME) -v .
$(GOBUILD) -v .
./$(BINARY_NAME) -config-file asld.toml

daemonize: clean proto
Expand Down
Loading

0 comments on commit 79e98a0

Please sign in to comment.