Skip to content

Commit

Permalink
Setup CI for adapter with service dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Paine <[email protected]>
  • Loading branch information
timkpaine committed Feb 3, 2024
1 parent 2acdade commit 7b48be6
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,3 +515,73 @@ jobs:
# run: make test

##########################################################################################################################

###########################
#~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~|#############|~~~~#
#~~~~~~|#|~~~~~~~/##/~~~~~#
#~~~~~~|#|~~~~~/##/~~~~~~~#
#~~~~~~~~~~~~/##/~~~~~~~~~#
#~~~~~~~~~~/##/~~~~~~~~~~~#
#~~~~~~~~/##/~~~~~~~~~~~~~#
#~~~~~~/##/~~~~~~~~~~~~~~~#
#~~~~~~~~~~~~~~~~~~~~~~~~~#
# Test Service Adapters #
#~~~~~~~~~~~~~~~~~~~~~~~~~#
test_adapters:
needs:
- initialize
- build

strategy:
matrix:
os:
- ubuntu-20.04
python-version:
- 3.9
adapter:
- kafka

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: ./.github/actions/setup-python
with:
version: '${{ matrix.python-version }}'

- name: Install python dependencies
run: make requirements

- name: Install test dependencies
shell: bash
run: sudo apt-get install graphviz

# Download artifact
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: csp-dist-${{ runner.os }}-${{ matrix.python-version }}

- name: Install wheel
run: python -m pip install -U *manylinux2014*.whl --target .

- name: Spin up adapter service
run: make dockerup ADAPTER=${{ matrix.adapter }}

# Run tests
- name: Setup test flagsl
shell: bash
run: echo "CSP_TEST_$( echo ${{ matrix.adapter }} | awk '{print toupper($0)}' )=1" >> $GITHUB_ENV

- name: Python Test Steps
run: make test TEST_ARGS="-k ${{ matrix.adapter }}"

- name: Spin down adapter service
run: make dockerdown ADAPTER=${{ matrix.adapter }}
if: ${{ always() }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tests: test

.PHONY: dockerup dockerps dockerdown initpodmanmac
ADAPTER := kafka
DOCKER := podman
DOCKER := docker

initpodmanmac:
podman machine stop
Expand Down
2 changes: 1 addition & 1 deletion csp/tests/adapters/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SubData(csp.Struct):
a: bool


class TestStatus:
class TestStatusKafka:
@pytest.mark.skipif(not os.environ.get("CSP_TEST_KAFKA"), reason="Skipping kafka adapter tests")
def test_basic(self, kafkaadapter):
topic = f"csp.unittest.{os.getpid()}"
Expand Down

0 comments on commit 7b48be6

Please sign in to comment.