Repository: jupyterhub/firstuseauthenticator (language: python)

Issue:
Migrate Travis CI to GitHub actions #



Discussion / hints:

Fix patch:
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..ffd6006
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,35 @@
+# Build releases and (on tags) publish to PyPI
+name: Release
+
+# always build releases (to make sure wheel-building works)
+# but only publish to PyPI on tags
+on:
+  push:
+  pull_request:
+
+jobs:
+  release:
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: 3.9
+
+      - name: install build package
+        run: |
+          pip install --upgrade pip
+          pip install build
+          pip freeze
+
+      - name: build release
+        run: |
+          python -m build --sdist --wheel .
+          ls -l dist
+
+      - name: publish to pypi
+        uses: pypa/gh-action-pypi-publish@v1.4.1
+        if: startsWith(github.ref, 'refs/tags/')
+        with:
+          user: __token__
+          password: ${{ secrets.pypi_password }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 6c5e206..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-language: python
-dist: xenial
-
-install:
-  - pip install --upgrade setuptools pip
-  - pip install --upgrade . -r dev-requirements.txt
-  - pip freeze
-
-script:
-  - pytest
-
-jobs:
-  fast_finish: true
-  include:
-    - python: 3.5
-    - python: 3.6
-    - python: 3.7
-    - python: 3.8
-    # Only deploy if all test jobs passed
-    - stage: deploy
-      python: 3.7
-      if: tag IS present
-      deploy:
-        provider: pypi
-        user: __token__
-        # password: set by TravisCI's environment variable PYPI_PASSWORD
-        distributions: sdist bdist_wheel
-        on:
-          # Without this we get the note about:
-          # Skipping a deployment with the pypi provider because this branch is not permitted: <tag>
-          tags: true
diff --git a/dev-requirements.txt b/dev-requirements.txt
index ee4ba01..21c5b9d 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,2 +1,4 @@
 pytest
 pytest-asyncio
+pytest-cov
+codecov


Test patch:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644
index 0000000..ae82a59
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,58 @@
+name: Tests
+
+on:
+  pull_request:
+  push:
+  workflow_dispatch:
+
+env:
+  # pytest colors: https://github.com/pytest-dev/pytest/issues/7443
+  FORCE_COLOR: "1"
+
+jobs:
+  test:
+    runs-on: ubuntu-20.04
+    timeout-minutes: 10
+
+    strategy:
+      # Keep running even if one variation of the job fail
+      fail-fast: false
+      matrix:
+        python:
+          - "3.6"
+          - "3.7"
+          - "3.8"
+          - "3.9"
+          - "3.10"
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Install Python ${{ matrix.python }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python }}
+
+      # preserve pip cache to speed up installation
+      - name: Cache pip
+        uses: actions/cache@v2
+        with:
+          path: ~/.cache/pip
+          # Look to see if there is a cache hit for the corresponding requirements file
+          key: ${{ runner.os }}-pip-${{ hashFiles('*requirements.txt') }}
+          restore-keys: |
+            ${{ runner.os }}-pip-
+
+      - name: Install Python dependencies
+        run: |
+          pip install --upgrade pip
+          pip install --upgrade . -r dev-requirements.txt
+          pip freeze
+
+      - name: Run tests
+        run: |
+          pytest -v --cov=firstuseauthenticator
+
+      - name: Submit codecov report
+        run: |
+          codecov
\ No newline at end of file