From 1720fccfea351d6e11c1e19e7562eb21c189f54f Mon Sep 17 00:00:00 2001 From: Devin Cowan Date: Wed, 26 Jun 2024 15:27:02 -0400 Subject: [PATCH] add HOST target parameter for workflow dispatch --- .github/workflows/python-package copy.yml | 42 +++++++++++++++++++++++ .github/workflows/python-package.yml | 1 - tests/conftest.py | 2 +- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/python-package copy.yml diff --git a/.github/workflows/python-package copy.yml b/.github/workflows/python-package copy.yml new file mode 100644 index 0000000..f9a07e8 --- /dev/null +++ b/.github/workflows/python-package copy.yml @@ -0,0 +1,42 @@ +name: Test on demand + +on: + workflow_dispatch: + inputs: + target: + description: 'URL to target tests (default: https://beta.hydroshare.org).' + +jobs: + build: + + strategy: + matrix: + python-version: [3.9] + platform: [ubuntu-latest] + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + make install + pip install . + - name: Run Tests against target = ${{ github.event.inputs.target }} + if: github.event.inputs.target != '' + env: + HYDRO_USERNAME: ${{ secrets.HYDRO_USERNAME }} + HYDRO_PASSWORD: ${{ secrets.HYDRO_PASSWORD }} + HYDRO_HOST: ${{ github.event.inputs.target }} + run: | + make test-cov + - name: Code Coverage Report + uses: romeovs/lcov-reporter-action@v0.2.11 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + lcov-file: ./coverage/lcov.info diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d48ab78..e8b47c2 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -8,7 +8,6 @@ on: branches: [ master ] pull_request_target: branches: [ master ] - workflow_dispatch: jobs: build: diff --git a/tests/conftest.py b/tests/conftest.py index 3ff5d13..af7e462 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,7 +12,7 @@ def change_test_dir(request): @pytest.fixture() def hydroshare(change_test_dir): - hs = HydroShare(os.getenv("HYDRO_USERNAME"), os.getenv("HYDRO_PASSWORD"), host="beta.hydroshare.org") + hs = HydroShare(os.getenv("HYDRO_USERNAME"), os.getenv("HYDRO_PASSWORD"), os.getenv("HYDRO_HOST", "beta.hydroshare.org")) return hs