penguin/tinyproxy

An L4 proxy designed to act as a tiny transparent shim

.github/workflows/cmake-multi-platform.yml

raw ยท 3606 bytes

name: tinyproxy CI

on:
  workflow_dispatch:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

env:
  ARTIFACT_RETENTION_DAYS: 30

jobs:
  linux-musl-x86_64:
    name: Linux musl x86_64 static
    runs-on: ubuntu-latest
    container:
      image: &alpine_image alpine:3.23

    steps:
      - &checkout
        uses: actions/checkout@v4

      - &install_linux_deps
        name: Install deps
        run: |
          apk add --no-cache \
            build-base \
            libevent-dev \
            libevent-static \
            python3 \
            haproxy

      - &build_static
        name: Build
        run: make clean all

      - &verify_static
        name: Verify static binary
        run: |
          apk add --no-cache pax-utils
          file bin/tinyproxy
          scanelf -n bin/tinyproxy

          if scanelf -n bin/tinyproxy | grep -q 'lib'; then
            echo "binary has dynamic library dependencies"
            exit 1
          fi

      - &test
        name: Test
        run: make test

      - &package_unix
        name: Package artifact
        run: |
          mkdir -p dist/tinyproxy
          cp bin/tinyproxy dist/tinyproxy/
          cp tinyproxy.conf dist/tinyproxy/
          tar -C dist -czf tinyproxy-${{ runner.os }}-${{ runner.arch }}.tar.gz tinyproxy

      - &upload_unix
        name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: tinyproxy-${{ runner.os }}-${{ runner.arch }}
          path: tinyproxy-${{ runner.os }}-${{ runner.arch }}.tar.gz
          if-no-files-found: error
          retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}

  linux-musl-arm64:
    name: Linux musl arm64 static
    runs-on: ubuntu-24.04-arm
    container:
      image: *alpine_image

    permissions:
      contents: read

    steps:
      - uses: laverdet/alpine-arm64@7f0f72ee2f71eb2324e5888e8b6e42b1b53e6160
        if: runner.arch == 'ARM64'

      - *checkout
      - *install_linux_deps
      - *build_static
      - *verify_static
      - *test
      - *package_unix
      - *upload_unix

  macos:
    name: macOS build
    runs-on: macos-15

    steps:
      - *checkout

      - name: Install deps
        run: |
          brew update
          brew install libevent haproxy

      - name: Build
        run: make clean all STATIC=0

      - *test
      - *package_unix
      - *upload_unix

  windows:
    name: Windows build
    runs-on: windows-2022
    continue-on-error: true

    steps:
      - *checkout

      - name: Set up MSYS2
        uses: msys2/setup-msys2@v2
        with:
          msystem: UCRT64
          update: true
          install: >-
            base-devel
            mingw-w64-ucrt-x86_64-gcc
            mingw-w64-ucrt-x86_64-pkgconf
            mingw-w64-ucrt-x86_64-libevent
            mingw-w64-ucrt-x86_64-python

      - name: Build
        shell: msys2 {0}
        run: |
          make clean
          make all

      - name: Test
        shell: msys2 {0}
        run: make test

      - name: Package artifact
        shell: msys2 {0}
        run: |
          mkdir -p dist/tinyproxy

          if [ -f bin/tinyproxy.exe ]; then
            cp bin/tinyproxy.exe dist/tinyproxy/
          else
            cp bin/tinyproxy dist/tinyproxy/tinyproxy.exe
          fi

          cp tinyproxy.conf dist/tinyproxy/

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: tinyproxy-Windows-X64
          path: dist/tinyproxy/
          if-no-files-found: error
          retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}