Skip to content

Commit

Permalink
Merge pull request #34 from reecetech/DE-5184-travis-to-gha
Browse files Browse the repository at this point in the history
Convert to use GitHub Actions instead of TravisCI
  • Loading branch information
ps-jay authored May 9, 2022
2 parents cf3ee50 + 2fde390 commit 1d1402b
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 60 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/test-build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: Test and Release

on:
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run tests
shell: bash
run: |
set -euo pipefail
./test-in-docker.sh
release:
if: ${{ github.ref == 'refs/heads/master' }}
needs:
- test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: semver

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Build package
shell: bash
run: |
set -euo pipefail
export VERSION="${{ steps.version.outputs.version }}"
python3 setup.py build sdist
- name: Release version on GitHub
uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: false
prerelease: false
automatic_release_tag: "${{ steps.version.outputs.version }}"

- name: Release version on PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
print_hash: true

# vim: set sw=2:
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ Requirements: Docker 19.03.2 or newer and Docker Compose 1.24.1 or newer.
Release History
---------------

Version 1.10.0
Version 1.11.1

- Convert from TravisCI to GitHub Actions

Version 1.11.0

- Begin support for Django 4.x
- End support for Django 2.x
Expand Down
1 change: 0 additions & 1 deletion django_informixdb/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
__version__ = '1.11.0'
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
INFORMIXDIR: /opt/IBM/informix
INFORMIXSQLHOSTS: /opt/IBM/informix/etc/sqlhosts
LD_LIBRARY_PATH: /opt/IBM/informix/lib:/opt/IBM/informix/lib/cli:/opt/IBM/informix/lib/esql
TRAVIS: ${TRAVIS:-}
volumes:
- type: bind
source: ./docker-compose.sqlhosts
Expand Down
19 changes: 16 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import os
import shlex
import shutil
import subprocess

from setuptools import setup, find_packages
from codecs import open
from os import path

from django_informixdb import __version__
here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()

# Obtain version from env (incremented by CI), or from git (local dev)
version = 'unknown'
if os.environ.get('VERSION'):
version = os.environ['VERSION']
else:
if shutil.which('git'):
gitcmd = shlex.split('git rev-parse --short HEAD')
gitproc = subprocess.run(gitcmd, capture_output=True, check=False)
version = f"git.{gitproc.stdout.decode().strip()}"

setup(
name='django_informixdb',
version=__version__,
version=version,
description='A database driver for Django to connect to an Informix db via ODBC',
long_description=long_description,
url='https://github.com/reecetech/django_informixdb',
Expand All @@ -24,7 +38,6 @@
'Topic :: Scientific/Engineering',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
Expand Down
19 changes: 0 additions & 19 deletions test-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,22 @@ set -euo pipefail
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1

if [[ -n "${TRAVIS:-}" ]] ; then
export BUILDKIT_PROGRESS=plain
fi


travis_fold() {
if [[ -n "${TRAVIS:-}" ]] ; then
local action=$1
local name=$2
echo -en "travis_fold:${action}:${name}\r"
fi
}

export uniq_test_id="${uniq_test_id:-djifx}"

cleanup() {
travis_fold start cleaning
echo "--- cleaning up: previous code ${?}"
docker-compose -p "${uniq_test_id}" down --volumes --remove-orphans
travis_fold end cleaning
}
trap cleanup EXIT

travis_fold start building
echo "--- building docker images"
docker-compose -p "${uniq_test_id}" build
travis_fold end building

travis_fold start dependencies
echo "--- starting dependencies"
docker-compose -p "${uniq_test_id}" up -d db

echo "--- waiting for dependencies"
docker-compose -p "${uniq_test_id}" run test-runner /usr/local/bin/wait-for-deps.sh
travis_fold end dependencies

echo "--- running tests"
docker-compose -p "${uniq_test_id}" run test-runner tox
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ deps =
pytest-cov
pytest-django
pytest-mock
pytest-travis-fold
freezegun

dj3: Django>=3.2.0,<4
Expand All @@ -22,7 +21,6 @@ commands =
{posargs}
passenv =
INFORMIXDIR
TRAVIS
setenv =
INFORMIXSQLHOSTS={env:INFORMIXDIR:}/etc/sqlhosts
LD_LIBRARY_PATH={env:INFORMIXDIR:}/lib/esql

0 comments on commit 1d1402b

Please sign in to comment.