Merge pull request #438 from SamR1/update-ci

CI - update workflows
This commit is contained in:
Sam 2023-10-04 11:05:32 +02:00 committed by GitHub
commit 22c29bf33f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 13 deletions

View File

@ -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

View File

@ -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
@ -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 }}
@ -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
@ -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"]
@ -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"]
@ -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"]
@ -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

View File

@ -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 = 'fittrackee@example.com'
OAUTH2_TOKEN_EXPIRES_IN = {

View File

@ -2128,7 +2128,7 @@ class TestPasswordResetRequest(ApiTestCaseMixin):
'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}'
@ -2235,7 +2235,7 @@ class TestPasswordUpdate(ApiTestCaseMixin):
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(
@ -2649,7 +2649,7 @@ class TestUserLogout(ApiTestCaseMixin):
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}'),

View File

@ -376,7 +376,7 @@ class TestUserModelToken:
) -> 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'