-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (64 loc) · 2.11 KB
/
build-setools.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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"