Skip to content

Fix ci tests

Fix ci tests #267

Workflow file for this run

name: Build tests
on: [push, pull_request]
env:
# This should be the minimum version required to run setools:
SELINUX_USERSPACE_VERSION: 3.2
# GitHub doesn't support building env
# vars from others in this block.
USERSPACE_SRC: /tmp/selinux-src
#SEPOL_SRC: ${USERSPACE_SRC}/libsepol
SEPOL_SRC: /tmp/selinux-src/libsepol
#LIBSEPOLA: ${SEPOL_SRC}/src/libsepol.a
LIBSEPOLA: /tmp/selinux-src/libsepol/src/libsepol.a
#SELINUX_SRC: ${USERSPACE_SRC}/libselinux
SELINUX_SRC: /tmp/selinux-src/libselinux
#CHECKPOLICY_SRC: ${USERSPACE_SRC}/checkpolicy
CHECKPOLICY_SRC: /tmp/selinux-src/checkpolicy
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
build-opts:
- {python: '3.10', tox: python3}
- {python: '3.11', tox: python3}
- {python: '3.12', tox: python3}
- {python: '3.11', tox: pep8}
- {python: '3.11', tox: lint}
- {python: '3.11', tox: mypy}
- {python: '3.11', tox: coverage}
- {python: '3.11', tox: install}
steps:
- uses: actions/checkout@v3
# This should be the minimum required Python version to build refpolicy.
- name: Set up Python ${{ matrix.build-opts.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.build-opts.python }}
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qqy \
bison \
flex \
gettext \
libaudit-dev \
libbz2-dev \
libgraphviz-dev \
libpcre3-dev \
xvfb \
x11-xserver-utils
python -m pip install -U --user \
tox
# This is a curated list of packages to get Qt to work with xvfb in
# GitHub actions. https://github.com/tlambert03/setup-qt-libs
- name: Install Qt dependencies
uses: tlambert03/setup-qt-libs@v1
- name: Cache SELinux userspace
uses: actions/cache@v3
id: cache-userspace
with:
path: ${{ env.USERSPACE_SRC }}
key: ${{ runner.os }}-selinux-userspace-${{ env.SELINUX_USERSPACE_VERSION }}
- name: Build SELinux userspace
if: ${{ steps.cache-userspace.outputs.cache-hit != 'true' }}
run: |
# Download current SELinux userspace tools and libraries
git clone https://github.com/SELinuxProject/selinux.git ${{env.USERSPACE_SRC}} -b ${{env.SELINUX_USERSPACE_VERSION}}
# Compile SELinux userspace
make -C ${{env.SEPOL_SRC}}
make CFLAGS="-O2 -pipe -fPIC -Wall -I${{env.SEPOL_SRC}}/include" LDFLAGS="-L${{env.SEPOL_SRC}}/src" -C ${{env.SELINUX_SRC}}
make CFLAGS="-O2 -pipe -fPIC -Wall -I${{env.SEPOL_SRC}}/include" -C ${{env.CHECKPOLICY_SRC}}
- name: Run test
run: |
# confirm python version
python --version
python -m tox -e ${{ matrix.build-opts.tox }}
env:
LD_LIBRARY_PATH: "${{env.SEPOL_SRC}}/src:${{env.SELINUX_SRC}}/src:${LD_LIBRARY_PATH}"