From ab94af17ea08b9a01f538fcb9779ec68fc6f6be9 Mon Sep 17 00:00:00 2001 From: Ryan Heuser Date: Sun, 24 Sep 2023 09:29:46 -0400 Subject: [PATCH] last line test?? --- .../{releases.yml => latest-release.yml} | 5 ++-- .github/workflows/stable-release.yml | 23 +++++++++++++++++++ geotaste/app.py | 1 + tests/test_app.py | 20 +++++++++++++++- 4 files changed, 45 insertions(+), 4 deletions(-) rename .github/workflows/{releases.yml => latest-release.yml} (83%) create mode 100644 .github/workflows/stable-release.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/latest-release.yml similarity index 83% rename from .github/workflows/releases.yml rename to .github/workflows/latest-release.yml index be46a67..8c57d69 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/latest-release.yml @@ -1,9 +1,8 @@ -name: "pre-release" +name: "latest-release" on: push: branches: - - "main" - "develop" jobs: @@ -19,6 +18,6 @@ jobs: uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ github.base_ref }}" + automatic_release_tag: "latest" prerelease: true title: "Development Build" diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml new file mode 100644 index 0000000..295e268 --- /dev/null +++ b/.github/workflows/stable-release.yml @@ -0,0 +1,23 @@ +name: "stable-release" + +on: + push: + branches: + - "main" + +jobs: + tests: + uses: "./.github/workflows/unit-tests.yml" # use the callable tests job to run tests + + pre-release: + name: "Release" + needs: [tests] + runs-on: "ubuntu-latest" + steps: + - name: "Releasing" + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "stable" + prerelease: false + title: "Stable Build" diff --git a/geotaste/app.py b/geotaste/app.py index b055763..3b8f767 100644 --- a/geotaste/app.py +++ b/geotaste/app.py @@ -69,6 +69,7 @@ def run(host=HOST, port=PORT, debug=DEBUG, url_base_pathname=ROOT_URL, dry_run=F with Logwatch('running app'): logger.debug(f'geotaste running at http://{host}:{port}') if not dry_run: + print('running geotaste app') app.run( host=host, port=port, diff --git a/tests/test_app.py b/tests/test_app.py index 7a9131b..0a51593 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1,3 +1,5 @@ +import subprocess,logging +from multiprocessing import Process, Queue import sys,os,tempfile sys.path.insert(0,os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from geotaste.imports import * @@ -301,4 +303,20 @@ def test_get_server(): app=get_app() assert isinstance(app, DashApp) assert isinstance(app.app, Dash) - assert isinstance(app.app.server, flask.app.Flask) \ No newline at end of file + assert isinstance(app.app.server, flask.app.Flask) + +def _apprun(q): + q.put(run(port=1992)) + + +def test_run(): + try: + queue = Queue() + p = Process(target=_apprun, args=(queue,)) + p.start() + time.sleep(10) + p.kill() + p.join() + assert True, 'server running succeeded' + except Exception: + assert False, 'server running failed' \ No newline at end of file