Skip to content
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

CI - update workflows #438

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/.tests-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ on:
paths: ['fittrackee_client/**']
pull_request:
paths: ['fittrackee_client/**']
types: [opened, synchronize, reopened]

env:
working-directory: fittrackee_client

jobs:
javascript:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/.tests-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: Python CI

on:
push:
paths-ignore: ['docs/**', 'docsrc/**', 'fittrackee_client/**', '*.md']
paths-ignore: ['docs/**', 'docsrc/**', 'docker/**', 'fittrackee_client/**', '*.md']
pull_request:
paths-ignore: ['docs/**', 'docsrc/**', 'fittrackee_client/**', '*.md']
paths-ignore: ['docs/**', 'docsrc/**', 'docker/**', 'fittrackee_client/**', '*.md']
types: [opened, synchronize, reopened]

env:
APP_SETTINGS: fittrackee.config.TestingConfig
Expand All @@ -15,6 +16,7 @@ env:

jobs:
python:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: python ${{ matrix.python-version }} (postgresql 15)
runs-on: ubuntu-latest
container: python:${{ matrix.python-version }}
Expand Down Expand Up @@ -54,9 +56,10 @@ jobs:
if: matrix.python-version == '3.11'
run: mypy fittrackee
- name: Pytest
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing --maxfail=1

postgresql:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: postgresql ${{ matrix.psql-version }} (python 3.11)
runs-on: ubuntu-latest
container: python:3.11
Expand Down Expand Up @@ -84,9 +87,10 @@ jobs:
poetry config virtualenvs.create false
poetry install --no-interaction --quiet
- name: Pytest
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing
run: pytest fittrackee -p no:warnings --cov fittrackee --cov-report term-missing --maxfail=1

end2end:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: e2e tests
runs-on: ubuntu-latest
needs: ["python"]
Expand Down Expand Up @@ -129,9 +133,10 @@ jobs:
export TEST_APP_URL=http://$(hostname --ip-address):5000
sleep 5
nohup flask worker --processes=1 >> nohup.out 2>&1 &
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 --maxfail=1

end2end_package:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: e2e tests with package
runs-on: ubuntu-latest
needs: ["python"]
Expand Down Expand Up @@ -182,9 +187,10 @@ jobs:
export TEST_APP_URL=http://$(hostname --ip-address):5000
sleep 5
nohup flask worker --processes=1 >> nohup.out 2>&1 &
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 --maxfail=1

end2end_package_update:
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.fork }}
name: e2e tests after update
runs-on: ubuntu-latest
needs: ["python"]
Expand Down Expand Up @@ -239,4 +245,4 @@ jobs:
export TEST_APP_URL=http://$(hostname --ip-address):5000
sleep 5
nohup flask worker --processes=1 >> nohup.out 2>&1 &
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444
pytest e2e --driver Remote --capability browserName firefox --selenium-host selenium --selenium-port 4444 --maxfail=1
4 changes: 2 additions & 2 deletions fittrackee/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ class TestingConfig(BaseConfig):
SECRET_KEY = 'test key' # nosec
BCRYPT_LOG_ROUNDS = 4
TOKEN_EXPIRATION_DAYS = 0
TOKEN_EXPIRATION_SECONDS = 3
PASSWORD_TOKEN_EXPIRATION_SECONDS = 3
TOKEN_EXPIRATION_SECONDS = 60
PASSWORD_TOKEN_EXPIRATION_SECONDS = 60
UI_URL = 'http://0.0.0.0:5000'
SENDER_EMAIL = '[email protected]'
OAUTH2_TOKEN_EXPIRES_IN = {
Expand Down
6 changes: 3 additions & 3 deletions fittrackee/tests/users/test_auth_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ def test_it_calls_reset_password_email_when_user_exists(
'email': user_1.email,
},
{
'expiration_delay': '3 seconds',
'expiration_delay': 'a minute',
'username': user_1.username,
'password_reset_url': (
f'http://0.0.0.0:5000/password-reset?token={token}'
Expand Down Expand Up @@ -2235,7 +2235,7 @@ def test_it_returns_error_if_token_is_expired(
token = get_user_token(user_1.id, password_reset=True)
client = app.test_client()

with freeze_time(now + timedelta(seconds=4)):
with freeze_time(now + timedelta(seconds=61)):
response = client.post(
'/api/auth/password/update',
data=json.dumps(
Expand Down Expand Up @@ -2649,7 +2649,7 @@ def test_it_returns_error_when_token_is_expired(
client, auth_token = self.get_test_client_and_auth_token(
app, user_1.email
)
with freeze_time(now + timedelta(seconds=4)):
with freeze_time(now + timedelta(seconds=61)):
response = client.post(
'/api/auth/logout',
headers=dict(Authorization=f'Bearer {auth_token}'),
Expand Down
2 changes: 1 addition & 1 deletion fittrackee/tests/users/test_users_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def test_it_returns_error_when_token_is_expired(
) -> None:
auth_token = user_1.encode_auth_token(user_1.id)
now = datetime.utcnow()
with freeze_time(now + timedelta(seconds=4)):
with freeze_time(now + timedelta(seconds=61)):
assert (
User.decode_auth_token(auth_token)
== 'signature expired, please log in again'
Expand Down