diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..94bc4fd3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,153 @@ +version: 2 +jobs: + build_linux: + docker: + - image: rflathers/centos5_python27 + working_directory: ~/impacket + steps: + - checkout + - run: + name: install impacket + command: | + pip install . + - run: + name: install pyinstaller + command: | + pip install pip==18.1 + pip install setuptools==40.6.3 + pip install pyinstaller==3.4 + - run: + name: gross hacky hack + command: | + sed -r -i 's/sys\.std(in|out)\.encoding/"UTF-8"/g' examples/*exec.py + - run: + name: Create standalone executables + command: | + for i in examples/*.py; do pyinstaller -F $i; done + - run: + name: Rename binaries + command: | + ARCH=$(uname -m) + find dist/ -type f -exec mv {} {}_linux_$ARCH \; + - run: + name: Tarball binaries + command: | + tar czf impacket_linux_binaries.tar.gz -C dist/ . + mv impacket_linux_binaries.tar.gz dist/ + - run: + name: Write version.txt + command: | + awk -F '"' '/version =/{print $2} ' setup.py > ./dist/version.txt + - store_artifacts: + path: ./dist + - persist_to_workspace: + root: dist + paths: + - ./* + build_windows: + docker: + - image: cdrx/pyinstaller-windows:python2 + working_directory: ~/impacket + steps: + - checkout + - run: + name: install impacket + command: | + pip install . + - run: + name: create standalone executables + command: | + for i in examples/*.py; do pyinstaller -F $i; done + - run: + name: rename binaries + command: | + for f in dist/*.exe; do mv "$f" "${f%.*}_windows.${f##*.}"; done + - run: + name: zip binaries + command: | + zip -r impacket_windows_binaries.zip dist/ + mv impacket_windows_binaries.zip dist/ + - store_artifacts: + path: ./dist + - persist_to_workspace: + root: dist + paths: + - ./* + build_alpine: + docker: + - image: rflathers/alpine34_pyinstaller:latest + working_directory: ~/impacket + steps: + - checkout + - run: + name: install impacket + command: | + pip install . + - run: + name: gross hacky hack + command: | + sed -r -i 's/sys\.std(in|out)\.encoding/"UTF-8"/g' examples/*exec.py + - run: + name: create standalone executables + command: | + for i in examples/*.py; do pyinstaller -F $i; done + - run: + name: Rename binaries + command: | + ARCH=$(uname -m) + find dist/ -type f -exec mv {} {}_musl_$ARCH \; + - run: + name: tarball binaries + command: | + tar czf impacket_musl_binaries.tar.gz -C dist/ . + - store_artifacts: + path: ./dist + - persist_to_workspace: + root: . + paths: + - impacket_musl_binaries.tar.gz + github-release: + docker: + - image: cibuilds/github:0.10 + steps: + - attach_workspace: + at: ./artifacts + - run: + name: "Publish Binaries on Github" + command: | + VERSION=$(cat ./artifacts/version.txt) + ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION}-binaries ./artifacts/ + +workflows: + version: 2 + main: + jobs: + - build_linux: + filters: + branches: + only: + - master + - /release-.*/ + - build_windows: + filters: + branches: + only: + - master + - /release-.*/ + - build_alpine: + filters: + branches: + only: + - master + - /release-.*/ + - github-release: + filters: + branches: + only: + - master + - /release-.*/ + context: "Github Token" + requires: + - build_linux + - build_windows + - build_alpine