Add github CI (#432)

Co-authored-by: Bohdan Vanieiev <bohdan.vanieiev@aptiv.com>
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..589fe61
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,41 @@
+name: CI
+
+on:
+    push:
+      branches:
+        - master
+    pull_request:
+      branches:
+        - master
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    # see /dev.Dockerfile
+    container: warchantua/py-toml-dev:v1
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Set up Go
+        uses: actions/setup-go@v4
+        with:
+          go-version: 1.21
+
+      - name: get toml-test
+        run: |
+            git clone https://github.com/BurntSushi/toml-test
+          # cd toml-test/cmd/toml-test
+          # go build
+
+      - name: Run python tests
+        run: |
+            pip -q install "tox>=4"
+            tox run-parallel --parallel-no-spinner
+
+      # TODO(warchant): this cmd is old, need to update it
+      # - name: Run go tests
+      #   run: |
+      #       pip -q install setuptools
+      #       python setup.py install
+      #       ./toml-test/cmd/toml-test/toml-test -i ./tests -g ./tests/gotests.sh
diff --git a/.gitignore b/.gitignore
index 83c2e1d..4b63ee6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -116,3 +116,6 @@
 
 # vscode
 .vscode
+
+
+toml-test
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 368dce1..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,33 +0,0 @@
-language: python
-cache: pip
-python:
- - "2.7"
- - "3.4"
- - "3.5"
- - "3.6"
- - "3.7"
- - "3.8"
- - "3.9-dev"
- #- "pypy"
-
-notifications:
-  email: false
-addons:
-  apt:
-    packages:
-    - git
-    - golang
-before_install:
- - export GOPATH=~/go
- - go get github.com/BurntSushi/toml-test
- - git clone https://github.com/BurntSushi/toml-test
-install:
- - pip install tox-travis
- - python setup.py install
- - chmod +x ./tests/*.sh
-script:
- - ~/go/bin/toml-test ./tests/decoding_test.sh
- - tox
- - tox -e check
-after_success:
- - tox -e codecov
diff --git a/dev.Dockerfile b/dev.Dockerfile
new file mode 100644
index 0000000..898475d
--- /dev/null
+++ b/dev.Dockerfile
@@ -0,0 +1,25 @@
+
+
+FROM ubuntu:22.04
+
+ENV PYENV_ROOT="/opt/.pyenv" \
+    PATH="/opt/pipx/bin:/opt/.pyenv/shims:/opt/.pyenv/bin:$PATH" \
+    PIPX_HOME="/opt/pipx" \
+    PIPX_BIN_DIR="/opt/pipx/bin"
+
+RUN mkdir $PIPX_HOME \
+    && apt-get update \
+    && apt-get install -y ccache build-essential git curl libssl-dev libz-dev libbz2-dev libncurses-dev libffi-dev libsqlite3-dev liblzma-dev libreadline-dev \
+    && curl https://pyenv.run | bash \
+    && git clone https://github.com/pyenv/pyenv-ccache.git $(pyenv root)/plugins/pyenv-ccache \
+    # NOTE: 3.3 installation fails with a segmentation fault :(
+    # NOTE: 3.4 installation fails: cannot find libssl (while it is installed)
+    && pyenv install 2.7 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 \
+    # enable all versions, 3.12 is default
+    && pyenv global 3.12 2.7 3.5 3.6 3.7 3.8 3.9 3.10 3.11 \
+    && pip install pipx \
+    && pipx install tox>=4 \
+    && pipx install poetry \
+    && pipx install pre-commit \
+    && ccache -C \
+    && rm -rf /var/lib/apt/lists/*
diff --git a/setup.py b/setup.py
index 32c245b..4dea03d 100644
--- a/setup.py
+++ b/setup.py
@@ -18,6 +18,7 @@
     packages=['toml'],
     license="MIT",
     long_description=readme_string,
+    setup_requires=['setuptools'],
     python_requires=">=2.6, !=3.0.*, !=3.1.*, !=3.2.*",
     classifiers=[
         'Development Status :: 5 - Production/Stable',
@@ -36,6 +37,9 @@
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
+        'Programming Language :: Python :: 3.11',
+        'Programming Language :: Python :: 3.12',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
     ]
diff --git a/tests/decoding_test.sh b/tests/decoding_test.sh
deleted file mode 100755
index 0a7cc43..0000000
--- a/tests/decoding_test.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-export PYTHONPATH=`pwd`
-python tests/decoding_test.py
diff --git a/tests/decoding_test2.sh b/tests/decoding_test2.sh
deleted file mode 100755
index dcae0e8..0000000
--- a/tests/decoding_test2.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-export PYTHONPATH=`pwd`
-python2 tests/decoding_test.py
diff --git a/tests/decoding_test3.sh b/tests/decoding_test3.sh
deleted file mode 100755
index 47aaec1..0000000
--- a/tests/decoding_test3.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-export PYTHONPATH=`pwd`
-python3 tests/decoding_test.py
diff --git a/tox.ini b/tox.ini
index 07ff124..2ecf8cc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,9 @@
 [tox]
-envlist = py27, py33, py34, py35, py36, py37, py38, py39, pypy
+min_version = 4.0
+# run this to setup all required interpreters:
+# pyenv global 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 2.7
+envlist = py27, py3{5,6,7,8,9,10,11,12}
+skip_missing_interpreters = True
 
 [testenv]
 deps =
@@ -22,3 +26,32 @@
 commands =
     pytest tests --cov=./toml
     codecov
+
+
+
+[testenv:py27]
+base_python = python2.7
+
+[testenv:py35]
+base_python = python3.5
+
+[testenv:py36]
+base_python = python3.6
+
+[testenv:py37]
+base_python = python3.7
+
+[testenv:py38]
+base_python = python3.8
+
+[testenv:py39]
+base_python = python3.9
+
+[testenv:py310]
+base_python = python3.10
+
+[testenv:py311]
+base_python = python3.11
+
+[testenv:py312]
+base_python = python3.12