mirror of
https://github.com/zensical/zensical.git
synced 2026-05-03 09:30:43 +00:00
50aa8a5eb8
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
298 lines
8.0 KiB
YAML
298 lines
8.0 KiB
YAML
# Copyright (c) 2025-2026 Zensical and contributors
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
# All contributions are certified under the DCO
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to
|
|
# deal in the Software without restriction, including without limitation the
|
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
# sell copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
# IN THE SOFTWARE.
|
|
|
|
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
required: true
|
|
type: string
|
|
attestations:
|
|
required: true
|
|
type: boolean
|
|
|
|
permissions:
|
|
attestations: write # Required for attestations
|
|
id-token: write # Required for OIDC
|
|
|
|
jobs:
|
|
linux:
|
|
name: Wheel (Linux, ${{ matrix.platform.target }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- target: x86_64
|
|
- target: x86
|
|
- target: aarch64
|
|
- target: armv7
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Prepare build
|
|
run: python scripts/prepare.py
|
|
|
|
- name: Build artifact
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
target: ${{ matrix.platform.target }}
|
|
manylinux: auto
|
|
# Temporary fix for https://github.com/zensical/zensical/issues/425
|
|
args: >-
|
|
--release --out artifacts
|
|
--interpreter python3.10
|
|
# args: --release --out artifacts
|
|
sccache: >
|
|
${{ !startsWith(github.event.pull_request.head.ref, 'release/') }}
|
|
|
|
- name: Create artifact attestation
|
|
if: inputs.attestations == true
|
|
uses: actions/attest@v4
|
|
with:
|
|
show-summary: false
|
|
subject-path: artifacts/*
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: wheel-linux-${{ matrix.platform.target }}
|
|
path: artifacts/*
|
|
|
|
musllinux:
|
|
name: Wheel (Linux, musl, ${{ matrix.platform.target }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- target: x86_64
|
|
- target: x86
|
|
- target: aarch64
|
|
- target: armv7
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Prepare build
|
|
run: python scripts/prepare.py
|
|
|
|
- name: Build artifact
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
target: ${{ matrix.platform.target }}
|
|
manylinux: musllinux_1_2
|
|
args: --release --out artifacts
|
|
sccache: >
|
|
${{ !startsWith(github.event.pull_request.head.ref, 'release/') }}
|
|
|
|
- name: Create artifact attestation
|
|
if: inputs.attestations == true
|
|
uses: actions/attest@v4
|
|
with:
|
|
show-summary: false
|
|
subject-path: artifacts/*
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: wheel-musllinux-${{ matrix.platform.target }}
|
|
path: artifacts/*
|
|
|
|
windows:
|
|
name: Wheel (Windows, ${{ matrix.platform.target }})
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- target: x64
|
|
- target: x86
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: 3.x
|
|
architecture: ${{ matrix.platform.target }}
|
|
|
|
- name: Prepare build
|
|
run: python scripts/prepare.py
|
|
|
|
- name: Build artifact
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
target: ${{ matrix.platform.target }}
|
|
args: --release --out artifacts
|
|
sccache: >
|
|
${{ !startsWith(github.event.pull_request.head.ref, 'release/') }}
|
|
|
|
- name: Create artifact attestation
|
|
if: inputs.attestations == true
|
|
uses: actions/attest@v4
|
|
with:
|
|
show-summary: false
|
|
subject-path: artifacts/*
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: wheel-windows-${{ matrix.platform.target }}
|
|
path: artifacts/*
|
|
|
|
macos:
|
|
name: Wheel (macOS, ${{ matrix.platform.target }})
|
|
runs-on: ${{ matrix.platform.runner }}
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- runner: macos-15-intel
|
|
target: x86_64
|
|
- runner: macos-15
|
|
target: aarch64
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Prepare build
|
|
run: python scripts/prepare.py
|
|
|
|
- name: Build artifact
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
target: ${{ matrix.platform.target }}
|
|
args: --release --out artifacts
|
|
sccache: >
|
|
${{ !startsWith(github.event.pull_request.head.ref, 'release/') }}
|
|
|
|
- name: Create artifact attestation
|
|
if: inputs.attestations == true
|
|
uses: actions/attest@v4
|
|
with:
|
|
show-summary: false
|
|
subject-path: artifacts/*
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: wheel-macos-${{ matrix.platform.target }}
|
|
path: artifacts/*
|
|
|
|
sdist:
|
|
name: Source distribution
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Prepare build
|
|
run: python scripts/prepare.py
|
|
|
|
- name: Build artifact
|
|
uses: PyO3/maturin-action@v1
|
|
with:
|
|
command: sdist
|
|
args: --out artifacts
|
|
|
|
- name: Create artifact attestation
|
|
if: inputs.attestations == true
|
|
uses: actions/attest@v4
|
|
with:
|
|
show-summary: false
|
|
subject-path: artifacts/*
|
|
|
|
- name: Upload sdist
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: wheel-sdist
|
|
path: artifacts/*
|
|
|
|
docker:
|
|
name: Docker image
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
IMAGE: ${{ github.event.repository.full_name }}
|
|
DOCKER_BUILDKIT: 1
|
|
DOCKER_BUILD_SUMMARY: false
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- name: Set up Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
with:
|
|
buildkitd-flags: --debug
|
|
|
|
- name: Build image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
load: true
|
|
tags: ${{ env.IMAGE }}:latest
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|