mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-22 03:13:02 +00:00
Reorganize scripts and E2E tests
This commit is contained in:
parent
417dce785a
commit
84f13dd792
15 changed files with 107 additions and 14 deletions
|
@ -6,6 +6,7 @@
|
|||
/tmp
|
||||
/docs
|
||||
/static
|
||||
/scripts
|
||||
/build
|
||||
/out
|
||||
/.git
|
||||
|
|
2
.github/workflows/main.yaml
vendored
2
.github/workflows/main.yaml
vendored
|
@ -44,4 +44,4 @@ jobs:
|
|||
python manage.py compilescss
|
||||
python manage.py collectstatic --ignore=*.scss
|
||||
- name: Run tests
|
||||
run: python manage.py test bookmarks.e2e
|
||||
run: python manage.py test bookmarks.e2e --pattern="e2e_test_*.py"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
module.exports = {
|
||||
ignoreIssuesWith: [
|
||||
"wontfix",
|
||||
"duplicate"
|
||||
]
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
rm -rf static
|
||||
npm run build
|
||||
python manage.py compilescss
|
||||
python manage.py collectstatic --ignore=*.scss
|
||||
python manage.py compilescss --delete-files
|
49
scripts/generate-changelog.py
Executable file
49
scripts/generate-changelog.py
Executable file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python3
|
||||
import requests
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def load_releases_page(page):
|
||||
url = f'https://api.github.com/repos/sissbruecker/linkding/releases?page={page}'
|
||||
return requests.get(url).json()
|
||||
|
||||
|
||||
def load_all_releases():
|
||||
load_next_page = True
|
||||
page = 1
|
||||
releases = []
|
||||
|
||||
while load_next_page:
|
||||
page_result = load_releases_page(page)
|
||||
releases = releases + page_result
|
||||
load_next_page = len(page_result) > 0
|
||||
page = page + 1
|
||||
|
||||
return releases
|
||||
|
||||
|
||||
def render_release_section(release):
|
||||
date = datetime.fromisoformat(release['published_at'].replace("Z", "+00:00"))
|
||||
formatted_date = date.strftime('%d/%m/%Y')
|
||||
section = f'## {release["name"]} ({formatted_date})\n\n'
|
||||
body = release['body']
|
||||
# increase heading for body content
|
||||
body = body.replace("## What's Changed", "### What's Changed")
|
||||
body = body.replace("## New Contributors", "### New Contributors")
|
||||
section += body.strip()
|
||||
return section
|
||||
|
||||
|
||||
def generate_change_log():
|
||||
releases = load_all_releases()
|
||||
|
||||
change_log = '# Changelog\n\n'
|
||||
sections = [render_release_section(release) for release in releases]
|
||||
body = '\n\n---\n\n'.join(sections)
|
||||
change_log = change_log + body
|
||||
|
||||
with open("CHANGELOG.md", "w") as file:
|
||||
file.write(change_log)
|
||||
|
||||
|
||||
generate_change_log()
|
10
scripts/run-docker.sh
Executable file
10
scripts/run-docker.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
docker build -t sissbruecker/linkding:local .
|
||||
|
||||
docker rm -f linkding-local || true
|
||||
|
||||
docker run --name linkding-local --rm -p 9090:9090 \
|
||||
-e LD_SUPERUSER_NAME=admin \
|
||||
-e LD_SUPERUSER_PASSWORD=admin \
|
||||
sissbruecker/linkding:local
|
14
scripts/test-e2e.sh
Executable file
14
scripts/test-e2e.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Make sure Chromium is installed
|
||||
playwright install chromium
|
||||
|
||||
# Test server loads assets from static folder, so make sure files there are up-to-date
|
||||
rm -rf static
|
||||
npm run build
|
||||
python manage.py compilescss
|
||||
python manage.py collectstatic --ignore=*.scss
|
||||
python manage.py compilescss --delete-files
|
||||
|
||||
# Run E2E tests
|
||||
python manage.py test bookmarks.e2e --pattern="e2e_test_*.py"
|
29
scripts/test-postgres.sh
Executable file
29
scripts/test-postgres.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Remove previous container if exists
|
||||
docker rm -f linkding-postgres-test || true
|
||||
|
||||
# Run postgres container
|
||||
docker run -d \
|
||||
-e POSTGRES_DB=linkding \
|
||||
-e POSTGRES_USER=linkding \
|
||||
-e POSTGRES_PASSWORD=linkding \
|
||||
-p 5432:5432 \
|
||||
--name linkding-postgres-test \
|
||||
postgres
|
||||
|
||||
# Wait until postgres has started
|
||||
echo >&2 "$(date +%Y%m%dt%H%M%S) Waiting for postgres container"
|
||||
sleep 15
|
||||
|
||||
# Run tests using postgres
|
||||
export LD_DB_ENGINE=postgres
|
||||
export LD_DB_USER=linkding
|
||||
export LD_DB_PASSWORD=linkding
|
||||
|
||||
./scripts/test.sh
|
||||
|
||||
# Remove postgres container
|
||||
docker rm -f linkding-postgres-test || true
|
1
scripts/test-unit.sh
Executable file
1
scripts/test-unit.sh
Executable file
|
@ -0,0 +1 @@
|
|||
python manage.py test bookmarks.tests
|
2
scripts/test.sh
Executable file
2
scripts/test.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
./scripts/test-unit.sh
|
||||
./scripts/test-e2e.sh
|
Loading…
Reference in a new issue