pipeline {
  agent {
    kubernetes {
      yaml '''
apiVersion: v1
kind: Pod
spec:
  containers:
  - name: python
    image: python:3.12-bookworm
    command: ["sleep"]
    args: ["3600"]
    resources:
      requests: { cpu: "200m", memory: "512Mi" }
      limits: { cpu: "2", memory: "2Gi" }
'''
      defaultContainer 'python'
    }
  }
  options {
    disableConcurrentBuilds()
    lock('langstitch-global')
    timeout(time: 45, unit: 'MINUTES') }
  stages {
    stage('Test & build') {
      steps {
        sh '''
          set -eu
          python -m pip install --upgrade pip
          pip install -e ".[dev,http,tracing]"
          python -m pytest -q
          pip install build twine
          python -m build
          python -m twine check dist/*
        '''
      }
    }
  }
}
