Skip to content

Move CI tests from Travis to GitHub #3889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 19, 2020
Merged
25 changes: 25 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "build"

on:
pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools six
python -m pip install pytest-cov -r requirements.txt
- name: Run tests
run: pytest --doctest-modules --ignore=project_euler/ --cov-report=term-missing:skip-covered --cov=. .
- if: ${{ success() }}
run: scripts/build_directory_md.py 2>&1 | tee DIRECTORY.md
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions ciphers/hill_cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def make_decrypt_key(self):
"""
>>> hill_cipher = HillCipher(numpy.array([[2, 5], [1, 6]]))
>>> hill_cipher.make_decrypt_key()
array([[ 6., 25.],
[ 5., 26.]])
array([[ 6, 25],
[ 5, 26]])
"""
det = round(numpy.linalg.det(self.encrypt_key))

Expand Down
5 changes: 3 additions & 2 deletions machine_learning/forecasting/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def linear_regression_prediction(
First method: linear regression
input : training data (date, total_user, total_event) in list of float
output : list of total user prediction in float
>>> linear_regression_prediction([2,3,4,5], [5,3,4,6], [3,1,2,4], [2,1], [2,2])
5.000000000000003
>>> n = linear_regression_prediction([2,3,4,5], [5,3,4,6], [3,1,2,4], [2,1], [2,2])
>>> abs(n - 5.0) < 1e-6 # Checking precision because of floating point errors
True
"""
x = [[1, item, train_mtch[i]] for i, item in enumerate(train_dt)]
x = np.array(x)
Expand Down
8 changes: 4 additions & 4 deletions web_programming/instagram_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InstagramUser:
"""
Class Instagram crawl instagram user information

Usage: (doctest failing on Travis CI)
Usage: (doctest failing on GitHub Actions)
# >>> instagram_user = InstagramUser("github")
# >>> instagram_user.is_verified
True
Expand Down Expand Up @@ -102,10 +102,10 @@ def test_instagram_user(username: str = "github") -> None:
A self running doctest
>>> test_instagram_user()
"""
from os import getenv
import os

if getenv("CONTINUOUS_INTEGRATION"):
return # test failing on Travis CI
if os.environ.get("CI"):
return None # test failing on GitHub Actions
instagram_user = InstagramUser(username)
assert instagram_user.user_data
assert isinstance(instagram_user.user_data, dict)
Expand Down