diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..37528a71 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,48 @@ +--- +name: CI +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + lint: + strategy: + fail-fast: false + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Set up Earthly + uses: earthly/actions-setup@v1 + - name: Lint + run: | + earthly --ci +lint + build: + strategy: + fail-fast: false + matrix: + os: + - "ubuntu:focal" + - "debian:bullseye" + - "ubuntu:jammy" + - "debian:bookworm" + # TODO(astraw/stdeb#195) + # - "ubuntu:noble" + # - "debian:trixie" + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Set up Earthly + uses: earthly/actions-setup@v1 + - name: Run tests + run: | + earthly --ci +test --OS=${{matrix.os}} + - name: Run pypi-install tests -- + run: | + earthly --ci +test-pypi-install --OS=${{matrix.os}} + - name: Run 2and3 tests + # This test can only be run on platforms that have Python 2 and Python 3 packages. + if: ${{contains(fromJSON('["ubuntu:focal", "debian:bullseye", "ubuntu:jammy"]'), matrix.os)}} + run: | + earthly --ci +test-2and3 --OS=${{matrix.os}} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b9c27527..00000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -# http://travis-ci.org/#!/astraw/stdeb -language: python -arch: - - amd64 - - ppc64le -python: - - "2.7_with_system_site_packages" - - "3.5_with_system_site_packages" -before_install: - - sudo apt-get update - - sudo apt-get install fakeroot python-all-dev python3-all-dev debhelper python-setuptools python3-setuptools apt-file python-requests - - wget http://debs.strawlab.org/precise/python3-requests_2.3.0-0ads1_all.deb -O python3-requests_2.3.0-0ads1_all.deb - - sudo dpkg -i python3-requests_2.3.0-0ads1_all.deb -install: - - which python - - which pip - - pip --version - - python -c "import sys; print(sys.version)" - # Build a .deb file and then install it. - - python setup.py --command-packages=stdeb.command bdist_deb - - for f in deb_dist/*.deb; do echo; echo $f; dpkg --contents $f; done - - sudo dpkg -i deb_dist/*.deb -script: - - sudo env "PATH=$PATH" bash -x ./test.sh - - sudo env "PATH=$PATH" bash -x ./test-pypi-install.sh - - sudo env "PATH=$PATH" bash -x ./test2and3.sh - - pip install flake8 - - flake8 --extend-ignore D scripts/* stdeb/ test_data/ `python -c "import sys;sys.stdout.write('--extend-exclude py3_module.py') if sys.version_info[0] == 2 else sys"` diff --git a/MANIFEST.in b/MANIFEST.in index 3c086a44..39d4c428 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,4 @@ include *.sh include stdeb.cfg include MANIFEST.in include .gitignore -include .travis.yml -include Vagrantfile* recursive-include test_data * diff --git a/README.rst b/README.rst index 61ad5e8f..f76bae37 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -.. image:: https://travis-ci.org/astraw/stdeb.png?branch=master - :target: https://travis-ci.org/astraw/stdeb +.. image:: https://github.com/astraw/stdeb/actions/workflows/ci.yaml/badge.svg + :target: https://github.com/astraw/stdeb/actions/workflows/ci.yaml stdeb - Python to Debian source package conversion utility ========================================================== @@ -883,7 +883,7 @@ Additional Credits * kzwin for interop with virtualenv * GitHub_ for hosting services. * WebFaction_ (aka `python-hosting`_) for previous hosting services. -* TravisCI_ for continuous integration +* TravisCI_ for previous continuous integration support .. _GitHub: http://github.com/ .. _WebFaction: http://webfaction.com/ diff --git a/Vagrantfile.debian-10-bookworm.rb b/Vagrantfile.debian-10-bookworm.rb deleted file mode 100644 index eddd188f..00000000 --- a/Vagrantfile.debian-10-bookworm.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: utf-8 - -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant::Config.run do |config| - config.vm.box_url = "https://downloads.sourceforge.net/project/vagrantboxjessie/debian80.box" - config.vm.box = "debian80" - - # install prerequisites for stdeb and tests - config.vm.provision :shell, :inline => "apt-get update" - config.vm.provision :shell, :inline => <<-SH - export DEBIAN_FRONTEND=noninteractive - apt-get install --yes build-essential debhelper python-all-dev python-setuptools apt-file python-requests python3-all-dev python3-setuptools libpq-dev - wget http://debs.strawlab.org/precise/python3-requests_2.3.0-0ads1_all.deb -O python3-requests_2.3.0-0ads1_all.deb - dpkg -i python3-requests_2.3.0-0ads1_all.deb -SH - - # We need to copy files to a new dir to prevent vagrant filesystem issues. - config.vm.provision :shell, :inline => "cp -a /vagrant /tmp/vagrant_copy" - - # Install stdeb - config.vm.provision :shell, :inline => "rm -rf /tmp/vagrant_copy/deb_dist" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True --with-python3=True --no-python3-scripts=True install_deb" - - # Run tests. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test-pypi-install.sh" - - # Run tests on Python 3. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test-pypi-install.sh" - - # Run more tests - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test2and3.sh" - -end diff --git a/Vagrantfile.debian-7-wheezy.rb b/Vagrantfile.debian-7-wheezy.rb deleted file mode 100644 index a1f105f5..00000000 --- a/Vagrantfile.debian-7-wheezy.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: utf-8 - -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant::Config.run do |config| - config.vm.box_url = "https://dl.dropboxusercontent.com/s/3jz559mjz2aw4gs/debian-wheezy-64-vanilla.box" - config.vm.box = "debian-wheezy-64-vanilla" - - # install prerequisites for stdeb and tests - config.vm.provision :shell, :inline => "apt-get update" - config.vm.provision :shell, :inline => <<-SH - export DEBIAN_FRONTEND=noninteractive - apt-get install --yes debhelper python-all-dev python-setuptools apt-file python-requests python3-all-dev python3-setuptools libpq-dev - wget http://debs.strawlab.org/precise/python3-requests_2.3.0-0ads1_all.deb -O python3-requests_2.3.0-0ads1_all.deb - dpkg -i python3-requests_2.3.0-0ads1_all.deb -SH - - # We need to copy files to a new dir to prevent vagrant filesystem issues. - config.vm.provision :shell, :inline => "cp -a /vagrant /tmp/vagrant_copy" - - # Install stdeb - config.vm.provision :shell, :inline => "rm -rf /tmp/vagrant_copy/deb_dist" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True --with-python3=True --no-python3-scripts=True install_deb" - - # Run tests. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test-pypi-install.sh" - - # Run tests on Python 3. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test-pypi-install.sh" - - # Run more tests - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test2and3.sh" - -end diff --git a/Vagrantfile.ubuntu-12.04-precise.rb b/Vagrantfile.ubuntu-12.04-precise.rb deleted file mode 100644 index d25f0b7f..00000000 --- a/Vagrantfile.ubuntu-12.04-precise.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: utf-8 - -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant::Config.run do |config| - config.vm.box = "precise64" - config.vm.box_url = "http://files.vagrantup.com/precise64.box" - - # install prerequisites for stdeb and tests - config.vm.provision :shell, :inline => "apt-get update" - config.vm.provision :shell, :inline => <<-SH - export DEBIAN_FRONTEND=noninteractive - apt-get install --yes debhelper python-all-dev python-setuptools apt-file python-requests python3-all-dev python3-setuptools libpq-dev - wget http://debs.strawlab.org/precise/python3-requests_2.3.0-0ads1_all.deb -O python3-requests_2.3.0-0ads1_all.deb - dpkg -i python3-requests_2.3.0-0ads1_all.deb -SH - - # We need to copy files to a new dir to prevent vagrant filesystem issues. - config.vm.provision :shell, :inline => "cp -a /vagrant /tmp/vagrant_copy" - - # Install stdeb - config.vm.provision :shell, :inline => "rm -rf /tmp/vagrant_copy/deb_dist" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True --with-python3=True --no-python3-scripts=True install_deb" - - # Run tests. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test-pypi-install.sh" - - # Run tests on Python 3. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test-pypi-install.sh" - - # Run more tests - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test2and3.sh" - -end diff --git a/Vagrantfile.ubuntu-14.04-trusty.rb b/Vagrantfile.ubuntu-14.04-trusty.rb deleted file mode 100644 index 7d297a7b..00000000 --- a/Vagrantfile.ubuntu-14.04-trusty.rb +++ /dev/null @@ -1,37 +0,0 @@ -# encoding: utf-8 - -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant::Config.run do |config| - config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" - config.vm.box = "trusty-server-cloudimg-amd64-vagrant-disk1" - - # install prerequisites for stdeb and tests - config.vm.provision :shell, :inline => "apt-get update" - config.vm.provision :shell, :inline => <<-SH - export DEBIAN_FRONTEND=noninteractive - apt-get install --yes debhelper python-all-dev python-setuptools apt-file python-requests python3-all-dev python3-setuptools libpq-dev - wget http://debs.strawlab.org/precise/python3-requests_2.3.0-0ads1_all.deb -O python3-requests_2.3.0-0ads1_all.deb - dpkg -i python3-requests_2.3.0-0ads1_all.deb -SH - - # We need to copy files to a new dir to prevent vagrant filesystem issues. - config.vm.provision :shell, :inline => "cp -a /vagrant /tmp/vagrant_copy" - - # Install stdeb - config.vm.provision :shell, :inline => "rm -rf /tmp/vagrant_copy/deb_dist" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && python setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True --with-python3=True --no-python3-scripts=True install_deb" - - # Run tests. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test-pypi-install.sh" - - # Run tests on Python 3. - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test.sh" - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && PYEXE=/usr/bin/python3 ./test-pypi-install.sh" - - # Run more tests - config.vm.provision :shell, :inline => "cd /tmp/vagrant_copy && ./test2and3.sh" - -end diff --git a/build.earth b/build.earth new file mode 100644 index 00000000..4818261e --- /dev/null +++ b/build.earth @@ -0,0 +1,59 @@ +VERSION 0.8 + + +SRC: + FUNCTION + COPY --dir scripts stdeb test_data \ + test*.sh *.txt *.py *.cfg *.toml *.rst \ + MANIFEST.in \ + /src/stdeb + WORKDIR /src/stdeb + +BUILD: + FUNCTION + ENV DEBIAN_FRONTEND=noninteractive + RUN apt-get update; apt-get install -y \ + # Build deps \ + debhelper dh-python python3-all python3-pip \ + # Install deps \ + python3-requests apt-file \ + # Test deps \ + libpq-dev python3-all-dev + + DO +SRC + RUN python3 setup.py --command-packages=stdeb.command bdist_deb + RUN for f in deb_dist/*.deb; do echo; echo $f; dpkg --contents $f; done + +INSTALL: + FUNCTION + # Install stdeb + RUN dpkg -i deb_dist/*.deb + +lint: + FROM docker.io/library/python:3.10-alpine + DO +SRC + RUN python3 -m pip install -r requirements.txt + RUN ruff format --check || true + RUN ruff check || true + +build: + ARG OS=debian:bookworm + FROM $OS + DO +BUILD + +test: + FROM +build + DO +INSTALL + RUN env PYEXE=/usr/bin/python3 bash -x ./test.sh + +test-pypi-install: + FROM +build + DO +INSTALL + RUN bash -x ./test-pypi-install.sh + +test-2and3: + FROM +build + DO +INSTALL + # Not all platforms provide python2 + RUN apt-get update; apt-get install -y python-all-dev || true + RUN bash -x ./test2and3.sh diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..39df351f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +ruff + diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..f11cf635 --- /dev/null +++ b/ruff.toml @@ -0,0 +1 @@ +line-length = 120 diff --git a/test.sh b/test.sh index f58b78e0..64dbde72 100755 --- a/test.sh +++ b/test.sh @@ -54,7 +54,7 @@ SOURCE_TARBALL=${SOURCE_TARBALL_DIR}.tar.gz DEBSOURCE=reindent-${SOURCE_RELEASE} elif [ $i -eq "3" ]; then SOURCE_PACKAGE=psycopg2 -SOURCE_RELEASE=2.7 +SOURCE_RELEASE=2.9.9 SOURCE_TARBALL_DIR=${SOURCE_PACKAGE}-${SOURCE_RELEASE} SOURCE_TARBALL=${SOURCE_TARBALL_DIR}.tar.gz DEBSOURCE=${SOURCE_TARBALL_DIR} @@ -95,9 +95,9 @@ rm -rf deb_dist # ============================================================== tar xzf $SOURCE_TARBALL cd $SOURCE_TARBALL_DIR -which python -python -c "import sys; print('sys.version',sys.version)" -python setup.py --command-packages=stdeb.command sdist_dsc +which python3 +python3 -c "import sys; print('sys.version',sys.version)" +python3 setup.py --command-packages=stdeb.command sdist_dsc cd deb_dist/$DEBSOURCE dpkg-buildpackage -rfakeroot -uc -us cd ../..