I'm trying to use Github Actions to package my Python project as .deb on a push. I'm using dh-virtualenv. I've tested it locally and it works fine, but I'm running into trouble with the Actions workflow. As far as I can tell, the problem is that some source and build directories that match .gitignore files aren't being read by the Action runner. I get the following error:
dpkg-source: info: using options from my-package/debian/source/options: --tar-ignore --tar-ignore=.coverage --tar-ignore=.tox --tar-ignore=.venv --tar-ignore=bin --tar-ignore=docs/_build --tar-ignore=*.log --tar-ignore=*.egg-info
debian/rules clean
test ! -d dist || rm -rf dist
test ! -d debian/my-package-0.1.6 || rm -rf debian/my-package-0.1.6
dh clean --setuptools --builtin-venv --python=/usr/bin/python3 --upgrade-pip --preinstall "setuptools>=38" --preinstall "wheel" --extra-pip-arg=--progress-bar=pretty --buildsystem=pybuild
dh_auto_clean -O--setuptools -O--builtin-venv -O--python=/usr/bin/python3 -O--upgrade-pip -O--preinstall=setuptools\>=38 -O--preinstall=wheel -O--extra-pip-arg=--progress-bar=pretty -O--buildsystem=pybuild
I: pybuild base:217: python3.8 setup.py clean
running clean
removing '/home/runner/work/my-package/my-package/.pybuild/cpython3_3.8/build' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.8' does not exist -- can't clean it
dh_clean -O--setuptools -O--builtin-venv -O--python=/usr/bin/python3 -O--upgrade-pip -O--preinstall=setuptools\>=38 -O--preinstall=wheel -O--extra-pip-arg=--progress-bar=pretty -O--buildsystem=pybuild
debian/rules build
dh build --with python-virtualenv --sourcedir debian/my-package-0.1.6 --buildsystem=pybuild
dh_update_autotools_config -O--sourcedir=debian/my-package-0.1.6 -O--buildsystem=pybuild
dh_auto_configure -O--sourcedir=debian/my-package-0.1.6 -O--buildsystem=pybuild
dh_auto_configure: error: invalid or non-existing path to the source directory: debian/my-package-0.1.6
make: *** [debian/rules:43: build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
Error: Process completed with exit code 2.
The command IS able to find all the other files in the repo that don't match .gitignore. In addition, when running through the same process on my local machine all source directories are created and found and there's no error.
My Actions workflow yml file looks like this:
build-deb:
name: Build deb package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Disable .gitignore for build
run: |
sudo rm ./.gitignore
sudo rm ./debian/.gitignore
sudo find . -name ".gitignore" -delete
- name: Prepare dh venv
run: |
sudo add-apt-repository ppa:jyrki-pulliainen/dh-virtualenv
sudo apt-get update
sudo apt-get install dh-virtualenv build-essential debhelper devscripts equivs
- name: Install Build Dependencies
run: |
sudo mk-build-deps --install debian/control
- name: Build .deb package
run: sudo dpkg-buildpackage -uc -us -b
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: deb
path: ../*.deb
As you can see, I've tried deleting the .gitignore files after checking out the code, but this doesn't work. I don't want to actually delete the .gitignore files from the repository, as I don't want all the build artifacts as part of the source. Is there something I'm missing here? Has anyone done this successfully?