Skip to content

Python-package

Python-package #10

Workflow file for this run

---
name: Python Build Package
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
env:
GOEXPERIMENT: cgocheck2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: false
- name: Install Xcaddy
run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
- name: Set up Python ${{ matrix.python-version }}
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -yyqq
sudo apt-get install -yyqq software-properties-common
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get install -yyqq python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv
sudo mv /usr/lib/x86_64-linux-gnu/pkgconfig/python-${{ matrix.python-version }}-embed.pc /usr/lib/x86_64-linux-gnu/pkgconfig/python3-embed.pc
- name: Run module tests
run: go test -race -v ./...
- name: Build the CLI
run: |
cd cmd/cli
CGO_ENABLED=1 go build -o caddysnake-cli main.go
touch dummy.c
python -m pip install cibuildwheel
export CIBW_BUILD=cp$(echo ${{ matrix.python-version }} | tr -d .)-manylinux_x86_64
echo $CIBW_BUILD
CIBW_BUILD_VERBOSITY=1 python -m cibuildwheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: cmd/cli/dist
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}