Repository: FORTH-ICS-INSPIRE/artemis (language: python)

Issue:
Migrate from travis to GitHub actions
**Is your feature request related to a problem? Please describe.**
While travis has served this open-source project perfectly during the last year, the new status where they move away from
open-source has started severely affecting our CI/CD pipelines.

**Describe the solution you'd like**
Use GitHub actions instead of travis.

**Describe alternatives you've considered**
N/A. GitHub actions seems to be the option of choice (state-of-the-art), and does not require third-party integrations.

**Additional context**
https://docs.github.com/en/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions
https://deanattali.com/blog/migrating-travis-to-github/



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
new file mode 100644
index 000000000..e5c885266
--- /dev/null
+++ b/.github/workflows/ci_cd.yml
@@ -0,0 +1,312 @@
+name: CI/CD
+
+on:
+  push:
+    branches: [ master, pull_request ]
+  pull_request:
+    branches: [ master ]
+
+env:
+    TRAVIS_PULL_REQUEST_BRANCH: ${{ github.head_ref }}
+    TRAVIS_BRANCH: ${{ github.base_ref }}
+    TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }}
+    TRAVIS_PULL_REQUEST: ${{ github.event.number }}
+    BUILD_TAG: ''
+    IS_FORK: ''
+    PUSH: ''
+
+jobs:
+
+  precommit-check:
+    name: Pre-commit Check
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: '3.6'
+      - name: install
+        run: |
+          pip install pre-commit pytest pytest-cov coverage==4.5.4 codecov==2.1.0
+          pip install -r backend-services/detection/requirements.txt
+          pre-commit install
+      - name: script
+        run: pre-commit run --all-files
+
+  migration-check:
+    name: Migration Check
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: print environment variables
+        run: env
+      - name: before script
+        run: docker-compose pull postgres
+      - name: script
+        run: make migration-check
+      - name: success
+        if: ${{ success() }}
+        run: docker-compose logs postgres
+      - name: failure
+        if: ${{ failure() }}
+        run: docker-compose logs postgres
+
+  build-and-push:
+    name: Build and Push Container Images
+    needs: [ precommit-check, migration-check ]
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: true
+      matrix:
+        service: [ "riperistap", "bgpstreamlivetap", "bgpstreamkafkatap", "bgpstreamhisttap", "exabgptap", "autoignore", "autostarter", "configuration", "database", "detection", "fileobserver", "mitigation", "notifier", "prefixtree", "frontend" ]
+    steps:
+      - uses: actions/checkout@v2
+      - name: set env vars
+        run: |
+          if [ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST_BRANCH == '' ]; then
+            echo "BUILD_TAG=latest" >> $GITHUB_ENV;
+          else
+            echo "BUILD_TAG=dev-PR$TRAVIS_PULL_REQUEST" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "IS_FORK=true" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "PUSH=false" >> $GITHUB_ENV;
+          else
+            echo "PUSH=true" >> $GITHUB_ENV;
+          fi;
+      - name: print environment variables
+        run: env
+      - name: check not fork
+        if: ${{ ! env.IS_FORK }}
+        run: echo "Not a fork. Proceeding..."
+      - name: Login to Docker Hub
+        if: ${{ ! env.IS_FORK }}
+        uses: docker/login-action@v1
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: make
+        run: make ${{ matrix.service }}
+
+  test-detection:
+    name: E2E Test Detection
+    needs: build-and-push
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: set env vars
+        run: |
+          if [ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST_BRANCH == '' ]; then
+            echo "BUILD_TAG=latest" >> $GITHUB_ENV;
+          else
+            echo "BUILD_TAG=dev-PR$TRAVIS_PULL_REQUEST" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "IS_FORK=true" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "PUSH=false" >> $GITHUB_ENV;
+          else
+            echo "PUSH=true" >> $GITHUB_ENV;
+          fi;
+      - name: print environment variables
+        run: env
+      - name: install
+        if: ${{ ! env.IS_FORK }}
+        run: pip install coverage==4.5.4 codecov==2.1.0
+      - name: before script setup
+        if: ${{ ! env.IS_FORK }}
+        run: make setup-dev
+      - name: before script build
+        run: docker build -t artemis_detection_testing testing/detection
+      - name: before script up
+        run: docker-compose -f docker-compose.testdetection.yaml up -d
+      - name: script
+        run: docker run --rm --env-file .env --network artemis_artemis artemis_detection_testing
+#      - name: success
+#        if: ${{ success() }}
+#        run: |
+#          sh convert_coverage.sh
+#          codecov
+      - name: failure
+        if: ${{ failure() }}
+        run: docker-compose -f docker-compose.testdetection.yaml logs
+
+  test-autoconf:
+    name: E2E Test Auto-configuration
+    needs: build-and-push
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set env vars
+        run: |
+          if [ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST_BRANCH == '' ]; then
+            echo "BUILD_TAG=latest" >> $GITHUB_ENV;
+          else
+            echo "BUILD_TAG=dev-PR$TRAVIS_PULL_REQUEST" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "IS_FORK=true" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "PUSH=false" >> $GITHUB_ENV;
+          else
+            echo "PUSH=true" >> $GITHUB_ENV;
+          fi;
+      - name: print environment variables
+        run: env
+      - name: install
+        if: ${{ ! env.IS_FORK }}
+        run: pip install coverage==4.5.4 codecov==2.1.0
+      - name: before script setup
+        if: ${{ ! env.IS_FORK }}
+        run: make setup-dev
+      - name: before script build
+        run: docker build -t artemis_autoconf_testing testing/autoconf
+      - name: before script up
+        run: docker-compose -f docker-compose.testautoconf.yaml up -d
+      - name: script
+        run: docker run --rm --env-file .env --network artemis_artemis artemis_autoconf_testing
+#      - name: success
+#        if: ${{ success() }}
+#        run: |
+#          sh convert_coverage.sh
+#          codecov
+      - name: failure
+        if: ${{ failure() }}
+        run: docker-compose -f docker-compose.testautoconf.yaml logs
+
+  benchmark:
+    name: E2E Benchmark
+    needs: build-and-push
+    runs-on: ubuntu-latest
+    env:
+      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+    steps:
+      - name: set env vars
+        run: |
+          if [ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST_BRANCH == '' ]; then
+            echo "BUILD_TAG=latest" >> $GITHUB_ENV;
+          else
+            echo "BUILD_TAG=dev-PR$TRAVIS_PULL_REQUEST" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "IS_FORK=true" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "PUSH=false" >> $GITHUB_ENV;
+          else
+            echo "PUSH=true" >> $GITHUB_ENV;
+          fi;
+      - name: print environment variables
+        run: env
+      - name: Git checkout
+        if: github.event_name == 'pull_request' && ! env.IS_FORK
+        uses: actions/checkout@v2
+      - name: before script setup
+        if: github.event_name == 'pull_request' && ! env.IS_FORK
+        run: make setup-dev
+      - name: before script build
+        if: github.event_name == 'pull_request' && ! env.IS_FORK
+        run: docker build -t artemis_benchmark testing/benchmark
+      - name: before script up
+        if: github.event_name == 'pull_request' && ! env.IS_FORK
+        run: docker-compose -f docker-compose.benchmark.yaml up --scale detection=4 --scale prefixtree=4 --scale database=4 -d
+      - name: script
+        if: github.event_name == 'pull_request' && ! env.IS_FORK
+        run: docker run --rm --env-file .env -e "REPO_SLUG=$TRAVIS_PULL_REQUEST_SLUG" -e "GITHUB_TOKEN=$GITHUB_TOKEN" -e "PULL_REQUEST_NUMBER=$TRAVIS_PULL_REQUEST"  --network artemis_artemis artemis_benchmark
+
+  test-autoignore:
+    name: E2E Test Auto-ignore
+    needs: build-and-push
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set env vars
+        run: |
+          if [ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST_BRANCH == '' ]; then
+            echo "BUILD_TAG=latest" >> $GITHUB_ENV;
+          else
+            echo "BUILD_TAG=dev-PR$TRAVIS_PULL_REQUEST" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "IS_FORK=true" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "PUSH=false" >> $GITHUB_ENV;
+          else
+            echo "PUSH=true" >> $GITHUB_ENV;
+          fi;
+      - name: print environment variables
+        run: env
+      - name: install
+        if: ${{ ! env.IS_FORK }}
+        run: pip install coverage==4.5.4 codecov==2.1.0
+      - name: before script setup
+        if: ${{ ! env.IS_FORK }}
+        run: make setup-dev
+      - name: before script build
+        run: docker build -t artemis_autoignore_testing testing/autoignore
+      - name: before script up
+        run: docker-compose -f docker-compose.testautoignore.yaml up -d
+      - name: script
+        run: docker run --rm --env-file .env --network artemis_artemis artemis_autoignore_testing
+#      - name: success
+#        if: ${{ success() }}
+#        run: |
+#          sh convert_coverage.sh
+#          codecov
+      - name: failure
+        if: ${{ failure() }}
+        run: docker-compose -f docker-compose.testautoignore.yaml logs
+
+  test-rpki:
+    name: E2E Test RPKI
+    needs: build-and-push
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set env vars
+        run: |
+          if [ $TRAVIS_BRANCH == 'master' ] && [ $TRAVIS_PULL_REQUEST_BRANCH == '' ]; then
+            echo "BUILD_TAG=latest" >> $GITHUB_ENV;
+          else
+            echo "BUILD_TAG=dev-PR$TRAVIS_PULL_REQUEST" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "IS_FORK=true" >> $GITHUB_ENV;
+          fi;
+          if [ $TRAVIS_PULL_REQUEST_BRANCH != '' ] && [ $TRAVIS_PULL_REQUEST_SLUG != 'FORTH-ICS-INSPIRE/artemis' ]; then
+            echo "PUSH=false" >> $GITHUB_ENV;
+          else
+            echo "PUSH=true" >> $GITHUB_ENV;
+          fi;
+      - name: print environment variables
+        run: env
+      - name: install
+        if: ${{ ! env.IS_FORK }}
+        run: pip install coverage==4.5.4 codecov==2.1.0
+      - name: before script setup
+        if: ${{ ! env.IS_FORK }}
+        run: make setup-dev
+      - name: before script setup routinator
+        run: make setup-routinator
+      - name: before script build
+        run: docker build -t artemis_rpki_testing testing/rpki
+      - name: before script run
+        run: docker run --rm -v $(pwd)/local_configs/routinator/tals:/home/routinator/.rpki-cache/tals nlnetlabs/routinator init -f --accept-arin-rpa
+      - name: before script up
+        run: docker-compose -f docker-compose.testrpki.yaml -f docker-compose.routinator.yaml up -d
+      - name: script
+        run: docker run --rm --env-file .env --network artemis_artemis artemis_rpki_testing
+#      - name: success
+#        if: ${{ success() }}
+#        run: |
+#          sh convert_coverage.sh
+#          codecov
+      - name: failure
+        if: ${{ failure() }}
+        run: docker-compose -f docker-compose.testrpki.yaml logs
diff --git a/backend-services/autoignore/requirements.txt b/backend-services/autoignore/requirements.txt
index 795f8ca20..09c120627 100644
--- a/backend-services/autoignore/requirements.txt
+++ b/backend-services/autoignore/requirements.txt
@@ -12,7 +12,7 @@ PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
 ruamel.yaml==0.16.5
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 tornado==6.0.4
 ujson==1.35
diff --git a/backend-services/configuration/requirements.txt b/backend-services/configuration/requirements.txt
index d05d70be1..ad96b2743 100644
--- a/backend-services/configuration/requirements.txt
+++ b/backend-services/configuration/requirements.txt
@@ -13,7 +13,7 @@ PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
 ruamel.yaml==0.16.5
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 tornado==6.0.4
 ujson==1.35
diff --git a/backend-services/database/requirements.txt b/backend-services/database/requirements.txt
index 795f8ca20..09c120627 100644
--- a/backend-services/database/requirements.txt
+++ b/backend-services/database/requirements.txt
@@ -12,7 +12,7 @@ PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
 ruamel.yaml==0.16.5
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 tornado==6.0.4
 ujson==1.35
diff --git a/backend-services/detection/requirements.txt b/backend-services/detection/requirements.txt
index 795f8ca20..09c120627 100644
--- a/backend-services/detection/requirements.txt
+++ b/backend-services/detection/requirements.txt
@@ -12,7 +12,7 @@ PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
 ruamel.yaml==0.16.5
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 tornado==6.0.4
 ujson==1.35
diff --git a/backend-services/fileobserver/requirements.txt b/backend-services/fileobserver/requirements.txt
index 10cec0de5..56a67aa42 100644
--- a/backend-services/fileobserver/requirements.txt
+++ b/backend-services/fileobserver/requirements.txt
@@ -6,7 +6,7 @@ gql==0.4.0
 ipaddress==1.0.23
 kubernetes==12.0.1
 requests==2.25.1
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 tornado==6.0.4
 ujson==1.35
diff --git a/backend-services/mitigation/requirements.txt b/backend-services/mitigation/requirements.txt
index 67dfeb2fc..f20648ace 100644
--- a/backend-services/mitigation/requirements.txt
+++ b/backend-services/mitigation/requirements.txt
@@ -12,7 +12,7 @@ PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
 ruamel.yaml==0.16.5
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 socketIO-client==0.7.2
 socketIO-client-nexus==0.7.6
diff --git a/backend-services/notifier/requirements.txt b/backend-services/notifier/requirements.txt
index 795f8ca20..09c120627 100644
--- a/backend-services/notifier/requirements.txt
+++ b/backend-services/notifier/requirements.txt
@@ -12,7 +12,7 @@ PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
 ruamel.yaml==0.16.5
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 tornado==6.0.4
 ujson==1.35
diff --git a/backend-services/prefixtree/requirements.txt b/backend-services/prefixtree/requirements.txt
index 795f8ca20..09c120627 100644
--- a/backend-services/prefixtree/requirements.txt
+++ b/backend-services/prefixtree/requirements.txt
@@ -12,7 +12,7 @@ PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
 ruamel.yaml==0.16.5
-six==1.13.0
+six==1.11.0
 slacker-log-handler==1.7.1
 tornado==6.0.4
 ujson==1.35
diff --git a/docs/changelog.md b/docs/changelog.md
index 22fbf96f8..3cbfc313b 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Changed
 - changes in "dataplane_msms" table and "view_dataplane_msms" view, in order to support the new design of the "dataplane_view" module.
 - upgraded artemis-utils to 1.0.10 to include the slacker-log-handler==1.7.1 dep
+- migrating from travis to GH actions
+- downgraded to six==1.11.0 to achieve compatibility
 
 ### Fixed
 - autoconfiguration subprefix bug in prefixtree plus new autoconf tests
diff --git a/.travis.yml b/other/.travis.yml.bk
similarity index 100%
rename from .travis.yml
rename to other/.travis.yml.bk


Test patch:
diff --git a/testing/autoconf/tester.py b/testing/autoconf/tester.py
index 38589e710..d67b88c0e 100644
--- a/testing/autoconf/tester.py
+++ b/testing/autoconf/tester.py
@@ -1,6 +1,5 @@
 import glob
 import os
-import re
 import time
 
 import psycopg2
@@ -233,23 +232,13 @@ def test(self):
             # wait for dependencies data workers to start
             wait_data_worker_dependencies(DATA_WORKER_DEPENDENCIES)
 
-            full_testfiles = glob.glob("testfiles/*.json")
-            testfiles_to_id = {}
-            for full_testfile in full_testfiles:
-                testfile = full_testfile.split("/")[-1]
-                id_match = re.match(r"^(\d+)_.*$", testfile)
-                if id_match:
-                    testfiles_to_id[testfile] = int(id_match.group(1))
-            testfiles = sorted(
-                list(testfiles_to_id.keys()), key=lambda x: testfiles_to_id[x]
-            )
-            for i, testfile in enumerate(testfiles):
+            for i, testfile in enumerate(sorted(glob.glob("testfiles/*.json"))):
                 print(
                     "[+] Commencing test {}: '{}'".format(
-                        i + 1, testfile.split(".json")[0]
+                        i + 1, testfile.split("/")[-1].split(".json")[0]
                     )
                 )
-                with open("testfiles/{}".format(testfile), "r") as f:
+                with open(testfile, "r") as f:
                     autoconf_test_info = json.load(f)
                     message = autoconf_test_info["send"]
                     self.expected_configuration = autoconf_test_info["configuration"]
diff --git a/testing/rpki/requirements.txt b/testing/rpki/requirements.txt
index e2cb9bc9d..03a2acc64 100644
--- a/testing/rpki/requirements.txt
+++ b/testing/rpki/requirements.txt
@@ -5,5 +5,5 @@ psycopg2-binary==2.8.4
 PyYAML==5.3
 redis==3.4.0
 requests==2.25.1
-six==1.13.0
+six==1.11.0
 ujson==1.35