Skip to content

Add type checking

Add type checking #75

Workflow file for this run

name: Build and Test
# Run this workflow whenever a PR is created or pushed to.
on:
pull_request:
types: [opened, synchronize]
jobs:
build:
strategy:
matrix:
# It's undocumented, but matrix variable arrays can be maps, too!
# https://stackoverflow.com/a/68940067/119527
os:
- version: "ubuntu-20.04"
native-python: "3.8"
- version: "ubuntu-22.04"
native-python: "3.10"
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
fail-fast: False
name: "${{matrix.os.version}}: Python ${{matrix.python-version}}"
runs-on: ${{ matrix.os.version }}
env:
TEST_DOCKER_IMAGE: "centos:5"
steps:
- uses: actions/checkout@v3
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
- run: git fetch --prune --unshallow
# We use Python from deadsnakes/action because the Python from
# actions/setup-python links with RUNPATH which is not compatible
# with StaticX. See #224.
- name: Set up Python ${{ matrix.python-version }}
uses: deadsnakes/action@v3.0.1
if: "(matrix.python-version != matrix.os.native-python)" # Already installed
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
sudo apt-get update
sudo apt-get install -y busybox musl-tools scons
docker pull $TEST_DOCKER_IMAGE
- name: List version info
run: |
echo "Installed version info:"
echo -e "\nPython:"
python --version
python -c "import sys; assert '.'.join(str(v) for v in sys.version_info[:2]) == sys.argv[1]" ${{ matrix.python-version }}
echo -e "\nPip:"
pip --version
echo -e "\nDocker:"
docker version
echo -e "\nGCC:"
gcc --version
echo -e "\nLD:"
ld --version
echo -e "\npatchelf:"
patchelf --version
- name: Static checks
run: |
mypy
- name: Build and install
run: |
python -m build
pip install dist/staticx-*-py3-none-manylinux1_x86_64.whl
staticx --version
# Make sure we only use the installed wheel
rm -r staticx bootloader
- name: Run unit tests
run: |
pytest -v
- name: Run integration tests
run: |
test/run_all.sh
- name: Run integration tests (w/o compression)
run: |
STATICX_FLAGS='--no-compress' test/run_all.sh
- name: Run integration tests (w/ strip)
run: |
STATICX_FLAGS='--strip' test/run_all.sh