Skip to content

Commit

Permalink
Merge pull request #1387 from mcha-forks/dev
Browse files Browse the repository at this point in the history
deps: migrate to Poetry & pyproject.toml
  • Loading branch information
xwings authored Jan 9, 2024
2 parents af939fe + 0dad55c commit 082b718
Show file tree
Hide file tree
Showing 8 changed files with 1,111 additions and 179 deletions.
84 changes: 39 additions & 45 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,81 +11,75 @@ jobs:
matrix:
#os: [windows-2019, macos-10.15, ubuntu-18.04, ubuntu-20.04]
os: [windows-latest, ubuntu-20.04]
python-version: [3.8, 3.9]
python-version: ["3.8", "3.9", "^3"]
include:
- os: ubuntu-22.04
python-version: 3.9
container: Docker

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Win setup MSVC
if: contains(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1

- name: Win setup MSVC
if: contains(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1


- name: Win configure Pagefile
if: contains(matrix.os, 'windows')
uses: al-cheb/configure-pagefile-action@v1.2
with:
- name: Win configure Pagefile
if: contains(matrix.os, 'windows')
uses: al-cheb/configure-pagefile-action@v1.2
with:
minimum-size: 16GB
maximum-size: 16GB
disk-root: "C:"


- name: win run tests
if: contains(matrix.os, 'windows')
shell: bash
run: |
- name: win run tests
if: contains(matrix.os, 'windows')
shell: bash
run: |
powershell Start-Process -PassThru -Wait PowerShell -ArgumentList "'-Command Set-MpPreference -DisableArchiveScanning \$true'"
powershell Start-Process -PassThru -Wait PowerShell -ArgumentList "'-Command Set-MpPreference -DisableBehaviorMonitoring \$true'"
powershell Start-Process -PassThru -Wait PowerShell -ArgumentList "'-Command Set-MpPreference -DisableRealtimeMonitoring \$true'"
powershell Start-Process -PassThru -Wait PowerShell -ArgumentList "'-Command Add-MpPreference -ExclusionPath $GITHUB_WORKSPACE'"
pip3 install setuptools wheel
pip3 install .
cd examples
rm -rf rootfs
curl -LJk -o master.zip https://github.com/qilingframework/rootfs/archive/refs/heads/master.zip && unzip master.zip
mv rootfs-master rootfs
cd $GITHUB_WORKSPACE
cd "$GITHUB_WORKSPACE"
cmd.exe //C 'examples\scripts\dllscollector.bat'
cd $GITHUB_WORKSPACE/examples/rootfs/x86_windows/bin
cd "$GITHUB_WORKSPACE/examples/rootfs/x86_windows/bin"
unzip -Pinfected wannacry.bin.zip
unzip -Pinfected UselessDisk.bin.zip
unzip -Pinfected GandCrab502.bin.zip
unzip -Pinfected al-khaser.bin.zip
unzip -Pinfected sality.dll.zip
cd $GITHUB_WORKSPACE/tests
cd "$GITHUB_WORKSPACE/tests"
cmd.exe //C '.\test_pe.bat'
- name: linux run tests
if: contains(matrix.os, 'ubuntu')
shell: 'script -q -e -c "bash {0}"'
run: |
cd examples
rm -rf rootfs
wget https://github.com/qilingframework/rootfs/archive/refs/heads/master.zip
unzip master.zip && mv rootfs-master rootfs
cd ../qiling
cd ../examples/rootfs/x86_linux/kernel && unzip -P infected m0hamed_rootkit.ko.zip
cd ../../../../
pip3 install -e .[RE]
- name: linux run tests
if: contains(matrix.os, 'ubuntu')
shell: 'script -q -e -c "bash {0}"'
run: |
cd examples
rm -rf rootfs
wget https://github.com/qilingframework/rootfs/archive/refs/heads/master.zip
unzip master.zip && mv rootfs-master rootfs
cd ../qiling
cd ../examples/rootfs/x86_linux/kernel && unzip -P infected m0hamed_rootkit.ko.zip
cd ../../../../
pip3 install -e .[RE]
if [ ${{ matrix.os }} == 'ubuntu-18.04' ] and [ ${{ matrix.python-version }} == '3.9' ]; then
docker run -it --rm -v ${GITHUB_WORKSPACE}:/qiling qilingframework/qiling:dev bash -c "cd tests && ./test_onlinux.sh"
else
pip3 install setuptools wheel
cd tests && ./test_onlinux.sh
fi
if [ ${{ matrix.os }} == 'ubuntu-18.04' ] and [ ${{ matrix.python-version }} == '3.9' ]; then
docker run -it --rm -v ${GITHUB_WORKSPACE}:/qiling qilingframework/qiling:dev bash -c "cd tests && ./test_onlinux.sh"
else
pip3 install poetry
cd tests && ./test_onlinux.sh
fi
# - name: mac run tests
# if: contains(matrix.os, 'macos')
Expand All @@ -97,4 +91,4 @@ jobs:
# cd $GITHUB_WORKSPACE/examples/rootfs/x8664_macos/kext
# unzip -Pinfected SuperRootkit.kext.zip
# cd $GITHUB_WORKSPACE/tests
# ./test_macho.sh
# ./test_macho.sh
2 changes: 1 addition & 1 deletion .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout git repo'
- name: "Checkout git repo"
uses: actions/checkout@v1

- name: Publish to registry
Expand Down
33 changes: 16 additions & 17 deletions .github/workflows/giteesync.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: sync to gitee
on:
push:
name: sync to gitee
on:
push:

jobs:
deploy:
runs-on: ubuntu-latest
if: github.repository_owner == 'qilingframework'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: xwings/sync-repo-action@master
with:
run: git config --global --add safe.directory *
ssh_private_key: ${{ secrets.GITEE_KEY }}
target_repo: ssh://git@gitee.com/qilingframework/qiling.git

jobs:
deploy:
runs-on: ubuntu-latest
if: github.repository_owner == 'qilingframework'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: xwings/sync-repo-action@master
with:
run: git config --global --add safe.directory *
ssh_private_key: ${{ secrets.GITEE_KEY }}
target_repo: ssh://git@gitee.com/qilingframework/qiling.git
27 changes: 12 additions & 15 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install setuptools wheel
- name: Build distribution 📦
run: |
pip install .
python setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/dist/*
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "^3.8"
- name: Install dependencies
run: pipx install poetry
- name: Build distribution 📦
run: poetry build -n
- uses: actions/upload-artifact@v2
with:
path: ${{ github.workspace }}/dist/*

publish:
needs: [build]
Expand Down
42 changes: 25 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
FROM python:3.8-slim AS builder
FROM python:3-slim AS base

LABEL maintainer="Kevin Foo <chfl4gs@qiling.io>"
WORKDIR /qiling

# hadolint global ignore=DL3008,DL3013
ENV DEBIAN_FRONTEND=noninteractive
ENV AM_I_IN_A_DOCKER_CONTAINER Yes
ENV AM_I_IN_A_DOCKER_CONTAINER=True

RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y --no-install-recommends cmake build-essential gcc git
RUN apt-get update && apt-get -y upgrade && rm -rf /var/lib/apt/lists/*


FROM base AS builder

COPY . /qiling
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake build-essential gcc git \
&& rm -rf /var/lib/apt/lists/*

RUN cd /qiling \
&& pip wheel . -w wheels
COPY pyproject.toml poetry.lock ./
RUN pip3 install --no-cache-dir poetry \
&& poetry install --no-root --no-directory

FROM python:3.8-slim AS base
COPY qiling/ tests/ examples/ ./
RUN poetry install --no-dev && poetry build --format=wheel

FROM base

LABEL maintainer="Kevin Foo <chfl4gs@qiling.io>"

COPY --from=builder /qiling /qiling

WORKDIR /qiling

RUN apt-get update \
&& apt-get install -y --no-install-recommends unzip apt-utils \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-deps wheels/*.whl \
&& rm -rf wheels

ENV HOME /qiling
&& apt-get install -y --no-install-recommends unzip apt-utils \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --no-deps --no-cache-dir dist/*.whl \
&& rm -rf ./dist/

CMD bash
CMD ["bash"]
Loading

0 comments on commit 082b718

Please sign in to comment.