Skip to content

Commit 1d1402b

Browse files
authored
Merge pull request reecetech#34 from reecetech/DE-5184-travis-to-gha
Convert to use GitHub Actions instead of TravisCI
2 parents cf3ee50 + 2fde390 commit 1d1402b

File tree

8 files changed

+87
-60
lines changed

8 files changed

+87
-60
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
name: Test and Release
3+
4+
on:
5+
push:
6+
branches:
7+
- '**'
8+
tags-ignore:
9+
- '**'
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Run tests
19+
shell: bash
20+
run: |
21+
set -euo pipefail
22+
./test-in-docker.sh
23+
24+
release:
25+
if: ${{ github.ref == 'refs/heads/master' }}
26+
needs:
27+
- test
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
33+
- name: Get next version
34+
uses: reecetech/version-increment@2022.2.5
35+
id: version
36+
with:
37+
scheme: semver
38+
39+
- name: Setup Python
40+
uses: actions/setup-python@v2
41+
with:
42+
python-version: '3.10'
43+
44+
- name: Build package
45+
shell: bash
46+
run: |
47+
set -euo pipefail
48+
export VERSION="${{ steps.version.outputs.version }}"
49+
python3 setup.py build sdist
50+
51+
- name: Release version on GitHub
52+
uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0
53+
with:
54+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
55+
draft: false
56+
prerelease: false
57+
automatic_release_tag: "${{ steps.version.outputs.version }}"
58+
59+
- name: Release version on PyPi
60+
uses: pypa/gh-action-pypi-publish@release/v1
61+
with:
62+
user: __token__
63+
password: ${{ secrets.PYPI_API_TOKEN }}
64+
print_hash: true
65+
66+
# vim: set sw=2:

.travis.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ Requirements: Docker 19.03.2 or newer and Docker Compose 1.24.1 or newer.
307307
Release History
308308
---------------
309309

310-
Version 1.10.0
310+
Version 1.11.1
311+
312+
- Convert from TravisCI to GitHub Actions
313+
314+
Version 1.11.0
311315

312316
- Begin support for Django 4.x
313317
- End support for Django 2.x

django_informixdb/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
__version__ = '1.11.0'

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ services:
1111
INFORMIXDIR: /opt/IBM/informix
1212
INFORMIXSQLHOSTS: /opt/IBM/informix/etc/sqlhosts
1313
LD_LIBRARY_PATH: /opt/IBM/informix/lib:/opt/IBM/informix/lib/cli:/opt/IBM/informix/lib/esql
14-
TRAVIS: ${TRAVIS:-}
1514
volumes:
1615
- type: bind
1716
source: ./docker-compose.sqlhosts

setup.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1+
import os
2+
import shlex
3+
import shutil
4+
import subprocess
5+
16
from setuptools import setup, find_packages
27
from codecs import open
38
from os import path
49

5-
from django_informixdb import __version__
610
here = path.abspath(path.dirname(__file__))
711

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

15+
# Obtain version from env (incremented by CI), or from git (local dev)
16+
version = 'unknown'
17+
if os.environ.get('VERSION'):
18+
version = os.environ['VERSION']
19+
else:
20+
if shutil.which('git'):
21+
gitcmd = shlex.split('git rev-parse --short HEAD')
22+
gitproc = subprocess.run(gitcmd, capture_output=True, check=False)
23+
version = f"git.{gitproc.stdout.decode().strip()}"
24+
1125
setup(
1226
name='django_informixdb',
13-
version=__version__,
27+
version=version,
1428
description='A database driver for Django to connect to an Informix db via ODBC',
1529
long_description=long_description,
1630
url='https://github.com/reecetech/django_informixdb',
@@ -24,7 +38,6 @@
2438
'Topic :: Scientific/Engineering',
2539
'License :: OSI Approved :: Apache Software License',
2640
'Programming Language :: Python :: 3',
27-
'Programming Language :: Python :: 3.6',
2841
'Programming Language :: Python :: 3.7',
2942
'Programming Language :: Python :: 3.8',
3043
'Programming Language :: Python :: 3.9',

test-in-docker.sh

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,22 @@ set -euo pipefail
44
export DOCKER_BUILDKIT=1
55
export COMPOSE_DOCKER_CLI_BUILD=1
66

7-
if [[ -n "${TRAVIS:-}" ]] ; then
8-
export BUILDKIT_PROGRESS=plain
9-
fi
10-
11-
12-
travis_fold() {
13-
if [[ -n "${TRAVIS:-}" ]] ; then
14-
local action=$1
15-
local name=$2
16-
echo -en "travis_fold:${action}:${name}\r"
17-
fi
18-
}
19-
207
export uniq_test_id="${uniq_test_id:-djifx}"
218

229
cleanup() {
23-
travis_fold start cleaning
2410
echo "--- cleaning up: previous code ${?}"
2511
docker-compose -p "${uniq_test_id}" down --volumes --remove-orphans
26-
travis_fold end cleaning
2712
}
2813
trap cleanup EXIT
2914

30-
travis_fold start building
3115
echo "--- building docker images"
3216
docker-compose -p "${uniq_test_id}" build
33-
travis_fold end building
3417

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

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

4324
echo "--- running tests"
4425
docker-compose -p "${uniq_test_id}" run test-runner tox

tox.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ deps =
77
pytest-cov
88
pytest-django
99
pytest-mock
10-
pytest-travis-fold
1110
freezegun
1211

1312
dj3: Django>=3.2.0,<4
@@ -22,7 +21,6 @@ commands =
2221
{posargs}
2322
passenv =
2423
INFORMIXDIR
25-
TRAVIS
2624
setenv =
2725
INFORMIXSQLHOSTS={env:INFORMIXDIR:}/etc/sqlhosts
2826
LD_LIBRARY_PATH={env:INFORMIXDIR:}/lib/esql

0 commit comments

Comments
 (0)