Repository: LibreTexts/ngshare (language: python)

Issue:
Migrate to Github Actions
Just merging from my fork into the main repository to see if codecov uploading will work


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/publish-helm.yml b/.github/workflows/publish-helm.yml
new file mode 100644
index 00000000..775643c9
--- /dev/null
+++ b/.github/workflows/publish-helm.yml
@@ -0,0 +1,33 @@
+name: Publish to DockerHub and helm repo
+on:
+  push:
+    tags:
+      - '*'
+jobs:
+  pypi:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+      - name: Login to Docker Hub
+        uses: docker/login-action@v2
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
+      - name: Build and push
+        uses: docker/build-push-action@v3
+        with:
+          push: true
+          tags: user/app:latest
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+      - run: |
+          echo ${HELM_SSH_KEY} > /tmp/ssh_key
+          chmod 400 /tmp/ssh_key
+          python3 -m pip install chartpress docker==4.2.1
+          cd helmchart
+          GIT_SSH_COMMAND="ssh -i /tmp/ssh_key" chartpress --push --publish-chart --tag ${{github.ref_name}}
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 00000000..99a0794f
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,20 @@
+name: Publish to PyPI.org
+on:
+  release:
+    types: [published]
+jobs:
+  pypi:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+      - run: |
+          python -m pip install --upgrade pip
+          python -m pip install setuptools wheel
+          python -m pip install .
+      - name: Publish package
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          password: ${{ secrets.PYPI_API_TOKEN }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 037d56d3..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-language: python
-python:
-- 3.6
-- 3.7
-- 3.8
-- nightly
-jobs:
-  allow_failures:
-  - python: nightly
-addons:
-  apt:
-    packages:
-    - python3-pip
-services:
-- docker
-cache: pip
-before_install:
-- python3 -m pip install setuptools wheel
-- curl -L https://git.io/get_helm.sh | bash && sudo mv `which helm` `which helm`2
-- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
-install:
-- python3 -m pip install .
-before_script:
-- python3 -m pip install -r testing_reqs.txt
-script:
-- python3 -m black -S -l 80 --check .
-- helm2 lint --strict helmchart/ngshare
-- helm lint --strict helmchart/ngshare
-- python3 -m pytest ./ngshare/ --cov=./ngshare/
-after_success:
-- codecov
-- |-
-  test ${TRAVIS_PYTHON_VERSION} = 3.8 &&
-  test -n "${DOCKER_PASSWORD}" &&
-  echo '{"mtu": 1460}' | sudo dd of=/etc/docker/daemon.json &&
-  sudo systemctl restart docker &&
-  docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" &&
-  openssl aes-256-cbc -K $encrypted_defe1004a0ce_key -iv $encrypted_defe1004a0ce_iv -in helmchart/ssh_key.enc -out /tmp/ssh_key -d &&
-  chmod 400 /tmp/ssh_key &&
-  python3 -m pip install chartpress docker==4.2.1 &&
-  cd helmchart &&
-  GIT_SSH_COMMAND="ssh -i /tmp/ssh_key" chartpress --push --publish-chart --long &&
-  test -n "${TRAVIS_TAG}" &&
-  GIT_SSH_COMMAND="ssh -i /tmp/ssh_key" chartpress --push --publish-chart --tag "${TRAVIS_TAG}"
-deploy:
-  provider: pypi
-  user: __token__
-  password:
-    secure: CnzfP5f78cuucJXf9Abgu2c9CC88/e/bo/b4lFGlcqZrjay5w0xG0arhGdIDWb8LtxmaX74l5Pm+QZi63uP+h5qUJiBh6pux1uhoyvtg3FMlpbHedqpPHYOYgqATeJ/UXeCTwFU37XZJQEJYB1YriwATYgdhpb0qbe105dVsBzhVuz+JNqyLXXPd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6xgbqS9QV9YgeQyhmVbm9xHI4YaRXK6fWphuWaYWDnJd3U/TtH/Jpk198Gbq93Cr1rtrOP/7i/aJ2YQx9Z5o9odUfL/RsesNut3USUgfqSshsrosYE/uDBdV2yOafRt7Qrr1vydB5lnYQCCR7S2IGZd0=
-  - secure: D41vAgHVParfr/C/YzTwtAe7VdtWadnOz2vC4u7j7F307ejKx7uVFUbCdWLB0WE0cHohnB069ezA4v2WEdGoOUfauPqVWY40pxYFvnr9hDhBOR8CgnaZVcOG/i1WMoqE7tEE020S4Oh9GLexI6j8evHhvFby0RR/IlzaI5YuEFRnbEJVZsh2kFRwlruM+znq3wmyXniXm6G5/B96vCo6C/VVKw4suKoviNodGFQrPqq0VwCqLlYzMvDlsyMFRtiNXXTK9ySwxf4dlEq/gv3qItACcGXV1Ey6vrm2nv49w1TLZdYfLyi2Dh6H9tn2WJwz7p4z+YS3kn3QO8pflJmuEOA5Gyq4RjfSCckfCAkwH1Zq5VuN9PyG0NKdOAtpivnAoNcPOHZeRFoJW1HCtStftNEeZbJ1hnQEaXl9nbF0F/T7K/r4tH8asPpPoUqFf93jp93CTilS5kwWDt+KAd67g2+gGzqVMl+FD4OtPYONMEfHYdz/rZh0JNZbFipcizUUxARJ5hSQ9WVgGIiPFxPMVOHuWul8yRDUWbqLKAhbYRu8w7otTqqM5dn10xzVqrYqFG4pOIRFm+axV3PPr9GI42xtpfWTwb2o2wyR87IpK42pJK6uGJbQHan1x5SHr0fT75v8N8cSZEnuvRtsW4OoXwq83TRsGycSRQnwDyPNEOA=
diff --git a/helmchart/ssh_key.enc b/helmchart/ssh_key.enc
deleted file mode 100644
index f617e08b..00000000
Binary files a/helmchart/ssh_key.enc and /dev/null differ


Test patch:
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
new file mode 100644
index 00000000..e79c73f0
--- /dev/null
+++ b/.github/workflows/testing.yml
@@ -0,0 +1,44 @@
+name: Python package
+
+on: [push]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
+
+    steps:
+      - uses: actions/checkout@v3
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          python -m pip install setuptools wheel
+          curl -L https://git.io/get_helm.sh | bash && sudo mv `which helm` `which helm`2
+          curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
+          python -m pip install .
+          python -m pip install -r testing_reqs.txt
+      - name: Lint with black and helm lint
+        run: |
+          python3 -m black -S -l 80 --check .
+          helm2 lint --strict helmchart/ngshare
+          helm lint --strict helmchart/ngshare
+      - name: Test with pytest
+        run: |
+          python3 -m pytest ./ngshare/ --cov=./ngshare/ --cov-report=xml
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v3
+        with:
+          directory: ./coverage/reports/
+          env_vars: OS,PYTHON
+          fail_ci_if_error: false
+          files: ./coverage.xml
+          flags: unittests
+          name: codecov-umbrella
+          verbose: true
diff --git a/ngshare/test_ngshare.py b/ngshare/test_ngshare.py
index 41845054..08e7d9d7 100644
--- a/ngshare/test_ngshare.py
+++ b/ngshare/test_ngshare.py
@@ -1253,7 +1253,7 @@ def test_corner_case(http_client, base_url):
     def mock_filename_create(self, filename):
         nonlocal counter
         counter += 1
-        return str(counter ** 2 % 10) + '.tmp'
+        return str(counter**2 % 10) + '.tmp'
 
     MyHelpers.filename_create = mock_filename_create
     for i in range(100):