-
Notifications
You must be signed in to change notification settings - Fork 47
Add CI job to build and run Python tests #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
name: PR validation | ||
on: | ||
pull_request: | ||
branches: ['main'] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
unit-tests: | ||
name: Run unit tests | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 120 | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install deps | ||
run: sudo apt-get install -y libboost-python-dev | ||
|
||
- name: Install Pulsar C++ client | ||
run: build-support/install-cpp-client.sh | ||
|
||
- name: CMake | ||
run: cmake . | ||
|
||
- name: Build | ||
run: make -j8 | ||
|
||
- name: Python install | ||
run: | | ||
./setup.py bdist_wheel | ||
WHEEL=$(find dist -name '*.whl') | ||
pip3 install ${WHEEL}[avro] | ||
|
||
- name: Start Pulsar service | ||
run: ./build-support/pulsar-test-service-start.sh | ||
|
||
- name: Run unit tests | ||
run: ./tests/run-unit-tests.sh | ||
|
||
- name: Stop Pulsar service | ||
run: ./build-support/pulsar-test-service-stop.sh | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ Makefile | |
_pulsar.so | ||
cmake_install.cmake | ||
__pycache__ | ||
.build | ||
.pulsar-mac-wheels-cache | ||
.DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -e -x | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
|
||
cd $ROOT_DIR | ||
|
||
CPP_CLIENT_VERSION=$(cat pulsar-client-cpp-version.txt | xargs) | ||
|
||
# Fetch the client binaries | ||
## TODO: Fetch from official release once it's available | ||
pushd /tmp | ||
curl -L -O https://github.com/merlimat/pulsar-client-cpp/releases/download/${CPP_CLIENT_VERSION}/apache-pulsar-client.deb | ||
curl -L -O https://github.com/merlimat/pulsar-client-cpp/releases/download/${CPP_CLIENT_VERSION}/apache-pulsar-client-dev.deb | ||
popd | ||
|
||
sudo apt install /tmp/apache-pulsar-client.deb /tmp/apache-pulsar-client-dev.deb | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -e | ||
|
||
SRC_DIR=$(git rev-parse --show-toplevel) | ||
cd $SRC_DIR | ||
|
||
./build-support/pulsar-test-service-stop.sh | ||
|
||
CONTAINER_ID=$(docker run -i -p 8080:8080 -p 6650:6650 -p 8443:8443 -p 6651:6651 --rm --detach apachepulsar/pulsar:latest sleep 3600) | ||
echo $CONTAINER_ID > .tests-container-id.txt | ||
|
||
docker cp tests/test-conf $CONTAINER_ID:/pulsar/test-conf | ||
docker cp build-support/start-test-service-inside-container.sh $CONTAINER_ID:start-test-service-inside-container.sh | ||
|
||
docker exec -i $CONTAINER_ID /start-test-service-inside-container.sh | ||
|
||
docker cp $CONTAINER_ID:/pulsar/data/tokens/token.txt tests/.test-token.txt | ||
|
||
echo "-- Ready to start tests" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -e | ||
|
||
SRC_DIR=$(git rev-parse --show-toplevel) | ||
cd $SRC_DIR | ||
|
||
CONTAINER_ID_PATH=".tests-container-id.txt" | ||
|
||
if [ -f ${CONTAINER_ID_PATH} ]; then | ||
CONTAINER_ID=$(cat $CONTAINER_ID_PATH) | ||
docker kill $CONTAINER_ID || true | ||
rm .tests-container-id.txt | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -e -x | ||
|
||
export PULSAR_EXTRA_OPTS=-Dpulsar.auth.basic.conf=test-conf/.htpasswd | ||
|
||
# Generate secret key and token | ||
mkdir -p data/tokens | ||
bin/pulsar tokens create-secret-key --output data/tokens/secret.key | ||
|
||
bin/pulsar tokens create \ | ||
--subject token-principal \ | ||
--secret-key file:///pulsar/data/tokens/secret.key \ | ||
> /pulsar/data/tokens/token.txt | ||
|
||
export PULSAR_STANDALONE_CONF=test-conf/standalone-ssl.conf | ||
export PULSAR_PID_DIR=/tmp | ||
bin/pulsar-daemon start standalone \ | ||
--no-functions-worker --no-stream-storage \ | ||
--bookkeeper-dir data/bookkeeper | ||
|
||
echo "-- Wait for Pulsar service to be ready" | ||
until curl http://localhost:8080/metrics > /dev/null 2>&1 ; do sleep 1; done | ||
|
||
echo "-- Pulsar service is ready -- Configure permissions" | ||
|
||
export PULSAR_CLIENT_CONF=test-conf/client-ssl.conf | ||
|
||
# Create "standalone" cluster if it does not exist | ||
bin/pulsar-admin clusters list | grep -q '^standalone$' || | ||
bin/pulsar-admin clusters create \ | ||
standalone \ | ||
--url http://localhost:8080/ \ | ||
--url-secure https://localhost:8443/ \ | ||
--broker-url pulsar://localhost:6650/ \ | ||
--broker-url-secure pulsar+ssl://localhost:6651/ | ||
|
||
# Update "public" tenant | ||
bin/pulsar-admin tenants create public -r "anonymous" -c "standalone" | ||
|
||
# Update "public/default" with no auth required | ||
bin/pulsar-admin namespaces create public/default -c standalone | ||
bin/pulsar-admin namespaces grant-permission public/default \ | ||
--actions produce,consume \ | ||
--role "anonymous" | ||
|
||
# Create "public/default-2" with no auth required | ||
bin/pulsar-admin namespaces create public/default-2 \ | ||
--clusters standalone | ||
bin/pulsar-admin namespaces grant-permission public/default-2 \ | ||
--actions produce,consume \ | ||
--role "anonymous" | ||
|
||
# Create "public/default-3" with no auth required | ||
bin/pulsar-admin namespaces create public/default-3 \ | ||
--clusters standalone | ||
bin/pulsar-admin namespaces grant-permission public/default-3 \ | ||
--actions produce,consume \ | ||
--role "anonymous" | ||
|
||
# Create "public/default-4" with encryption required | ||
bin/pulsar-admin namespaces create public/default-4 \ | ||
--clusters standalone | ||
bin/pulsar-admin namespaces grant-permission public/default-4 \ | ||
--actions produce,consume \ | ||
--role "anonymous" | ||
bin/pulsar-admin namespaces set-encryption-required public/default-4 -e | ||
|
||
# Create "public/test-backlog-quotas" to test backlog quotas policy | ||
bin/pulsar-admin namespaces create public/test-backlog-quotas \ | ||
--clusters standalone | ||
|
||
# Create "private" tenant | ||
bin/pulsar-admin tenants create private -r "" -c "standalone" | ||
|
||
# Create "private/auth" with required authentication | ||
bin/pulsar-admin namespaces create private/auth --clusters standalone | ||
|
||
bin/pulsar-admin namespaces grant-permission private/auth \ | ||
--actions produce,consume \ | ||
--role "token-principal" | ||
|
||
echo "-- Ready to start tests" |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0.0-pre-1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.