Skip to content

Load Balancer Partition -- Golang #26

Load Balancer Partition -- Golang

Load Balancer Partition -- Golang #26

name: Load Balancers
on:
pull_request:
branches: [main]
paths:
- 'python/load_balancer/**'
- 'golang/load-balancer/**'
push:
branches: [main]
workflow_dispatch: {}
concurrency:
group: lbs-${{ github.ref }}
cancel-in-progress: true
jobs:
load-balancers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [python, golang]
steps:
- uses: actions/checkout@v4
- name: Install Docker compose + nc
run: |
sudo apt-get update
sudo apt-get install -y netcat-openbsd
- name: Setup runtimes (per target)
if: matrix.target == 'python'
uses: actions/setup-python@v5
with: { python-version: '3.9' }
- name: Setup Node
if: matrix.target == 'nodejs'
uses: actions/setup-node@v4
with: { node-version: '22' }
- name: Setup Go
if: matrix.target == 'golang'
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
check-latest: true
cache: true
- name: docker compose up
working-directory: ${{ matrix.target == 'python' && 'python/load_balancer' || matrix.target == 'nodejs' && 'nodejs/load-balancer' || 'golang/load-balancer' }}
run: docker compose -f ../../common/docker-compose-load-balancer.yaml up -d --wait
- name: Python LB tests
if: matrix.target == 'python'
working-directory: python/load_balancer
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pytest tests/ -v --maxfail=1
- name: Node LB tests
if: matrix.target == 'nodejs'
working-directory: nodejs/load-balancer
run: |
npm ci
npm test
- name: Go LB tests
if: matrix.target == 'golang'
working-directory: golang/load-balancer
run: |
go mod tidy
go build ./...
go test -v ./tests/
- name: docker compose down
if: always()
working-directory: ${{ matrix.target == 'python' && 'python/load_balancer' || matrix.target == 'nodejs' && 'nodejs/load-balancer' || 'golang/load-balancer' }}
run: docker compose -f ../../common/docker-compose-load-balancer.yaml down -v