74 lines
2.1 KiB
YAML
74 lines
2.1 KiB
YAML
name: Build SETools
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
description: "SETools version (a git commit ID, tag, or branch)"
|
|
type: string
|
|
required: true
|
|
python-version:
|
|
description: "Python version to use"
|
|
type: string
|
|
required: true
|
|
outputs:
|
|
artifact-id:
|
|
description: "SETools wheel artifact ID"
|
|
value: ${{ jobs.build.outputs.artifact-id }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }}
|
|
|
|
steps:
|
|
- name: Download cached SETools
|
|
uses: actions/cache@v4
|
|
id: cache-setools
|
|
with:
|
|
path: "setools-*.whl"
|
|
key: setools-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}-Python${{ inputs.python-version }}
|
|
|
|
- name: Checkout setools
|
|
uses: actions/checkout@v4
|
|
if: ${{ steps.cache-setools.outputs.cache-hit != 'true' }}
|
|
with:
|
|
repository: SELinuxProject/setools
|
|
ref: "${{ inputs.version }}"
|
|
|
|
- name: Download userspace artifact
|
|
uses: actions/download-artifact@v4
|
|
if: ${{ steps.cache-setools.outputs.cache-hit != 'true' }}
|
|
id: dl-userspace
|
|
with:
|
|
name: selinux
|
|
|
|
- name: Install dependencies
|
|
shell: bash
|
|
if: ${{ steps.cache-setools.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
sudo apt-get update -q
|
|
tar -C "${{ steps.dl-userspace.outputs.download-path }}" -zxvf selinux.tar.gz
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
if: ${{ steps.cache-setools.outputs.cache-hit != 'true' }}
|
|
with:
|
|
python-version: "${{ inputs.python-version }}"
|
|
|
|
- name: Build setools
|
|
shell: bash
|
|
if: ${{ steps.cache-setools.outputs.cache-hit != 'true' }}
|
|
run: pip wheel --no-deps .
|
|
env:
|
|
CFLAGS: "-O2"
|
|
LD_LIBRARY_PATH: "${{steps.dl-userspace.outputs.download-path}}/lib:${{steps.dl-userspace.outputs.download-path}}/usr/lib:${LD_LIBRARY_PATH}"
|
|
|
|
- name: Upload wheel
|
|
uses: actions/upload-artifact@v4
|
|
id: upload-artifact
|
|
with:
|
|
name: setools
|
|
path: "setools-*.whl"
|