Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial attempt at GitHub Actions based CI. #199

Merged
merged 10 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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}}
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ include *.sh
include stdeb.cfg
include MANIFEST.in
include .gitignore
include .travis.yml
include Vagrantfile*
recursive-include test_data *
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -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
==========================================================
Expand Down Expand Up @@ -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/
Expand Down
37 changes: 0 additions & 37 deletions Vagrantfile.debian-10-bookworm.rb

This file was deleted.

37 changes: 0 additions & 37 deletions Vagrantfile.debian-7-wheezy.rb

This file was deleted.

37 changes: 0 additions & 37 deletions Vagrantfile.ubuntu-12.04-precise.rb

This file was deleted.

37 changes: 0 additions & 37 deletions Vagrantfile.ubuntu-14.04-trusty.rb

This file was deleted.

59 changes: 59 additions & 0 deletions build.earth
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ruff

1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
line-length = 120
8 changes: 4 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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 ../..
Expand Down