Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/actions/compose/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,3 @@ runs:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
shell: bash
- run: pip install --upgrade pip
shell: bash
- run: pip install -e .
shell: bash
9 changes: 3 additions & 6 deletions .github/actions/k8s/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ runs:
docker image ls -a

echo Installing warnet python package for cli
pip install --upgrade pip
pip install -e .
uv pip install --system --break-system-packages --no-cache -r requirements.txt
uv pip install --system --break-system-packages --no-cache -e .

echo patching k8s configs to use local image
echo Patching warnet-rpc-statefulset-dev to use local registry
sed -i "s|imagePullPolicy: Always|imagePullPolicy: Never|g" src/templates/rpc/warnet-rpc-statefulset-dev.yaml
sed -i "s|bitcoindevproject/warnet-rpc:dev|local/warnet-rpc:ci|g" src/templates/rpc/warnet-rpc-statefulset-dev.yaml
echo "Using warnet-rpc-statefulset-dev.yaml:"
cat src/templates/rpc/warnet-rpc-statefulset-dev.yaml

echo Setting up k8s
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
file: src/templates/rpc/Dockerfile_rpc
context: .
tags: local/warnet-rpc:ci
tags: warnet/dev
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=docker,dest=/tmp/warnet.tar
Expand All @@ -46,6 +46,7 @@ jobs:
test: [scenarios_test.py, rpc_test.py, graph_test.py, ln_test.py, get_service_ip_test.py]
steps:
- uses: actions/checkout@v4
- uses: hynek/setup-cached-uv@v1
- if: matrix.backend == 'compose'
uses: ./.github/actions/compose
- if: matrix.backend == 'k8s'
Expand All @@ -54,11 +55,20 @@ jobs:
run: |
kubectl port-forward svc/rpc 9276:9276 &
- name: Run tests
run: ./test/${{matrix.test}} ${{matrix.backend}}
run: |
uv venv
source .venv/bin/activate
uv pip install .
test/${{matrix.test}} ${{matrix.backend}}
build-test:
needs: [build-image]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hynek/setup-cached-uv@v1
- uses: ./.github/actions/compose
- run: ./test/build_branch_test.py compose
- run: |
uv venv
source .venv/bin/activate
uv pip install .
test/build_branch_test.py compose
6 changes: 5 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ start:

minikube start --mount --mount-string="$PWD:/mnt/src"

# Build image in local registry and load into minikube
docker build -t warnet/dev -f src/templates/rpc/Dockerfile_rpc_dev . --load
minikube image load warnet/dev

# Setup k8s
kubectl apply -f src/templates/rpc/namespace.yaml
kubectl apply -f src/templates/rpc/rbac-config.yaml
Expand Down Expand Up @@ -87,4 +91,4 @@ installlogging:
./src/templates/k8s/install_logging.sh

connectlogging:
./src/templates/k8s/connect_logging.sh
./src/templates/k8s/connect_logging.sh
12 changes: 10 additions & 2 deletions src/templates/rpc/Dockerfile_rpc
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# Use an official Python runtime as the base image
FROM python:3.11-slim
FROM python:3.12-slim

# Install procps, which includes pgrep
RUN apt-get update && \
apt-get install -y procps openssh-client && \
rm -rf /var/lib/apt/lists/*

# Install `uv` packge installer (https://github.com/astral-sh/uv)
RUN pip install uv

# Set the working directory in the container
WORKDIR /root/warnet

# Get better caching by installing before copying code
COPY requirements.txt .
RUN uv pip install --system -r requirements.txt

# Copy the source directory contents into the container
COPY . /root/warnet
RUN pip install .
# Install Warnet scripts
RUN uv pip install --system .

# Make port 9276 available to the world outside this container
# Change the port if your server is running on a different port
Expand Down
5 changes: 4 additions & 1 deletion src/templates/rpc/Dockerfile_rpc_dev
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Use an official Python runtime as the base image
FROM python:3.11-slim
FROM python:3.12-slim

# Install procps, which includes pgrep
RUN apt-get update && \
apt-get install -y procps openssh-client && \
rm -rf /var/lib/apt/lists/*

# Install `uv` packge installer (https://github.com/astral-sh/uv)
RUN pip install uv

# Set the working directory in the container
WORKDIR /root/warnet

Expand Down
2 changes: 1 addition & 1 deletion src/templates/rpc/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ done
if check_setup_toml; then
echo "Installing package from ${SOURCE_DIR}..."
cd ${SOURCE_DIR}
pip install -e .
uv pip install --system -e .
fi

# Execute the CMD from the Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions src/templates/rpc/warnet-rpc-statefulset-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ spec:
spec:
containers:
- name: warnet-rpc
imagePullPolicy: Always
image: bitcoindevproject/warnet-rpc:dev
imagePullPolicy: Never
image: warnet/dev
ports:
- containerPort: 9276
volumeMounts:
Expand Down