Skip to content

Commit

Permalink
Moving env vars around
Browse files Browse the repository at this point in the history
Moved environment variables to jobs section to hopefully make them accessible throughout the workflow.  Added an echo test to see if the variables are carried to the steps. Added a print to TestNominatim.py to see if there are any environment variable keys available.
  • Loading branch information
nataliejschultz committed Sep 19, 2023
1 parent 60d2b6b commit 8f2c032
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/nominatim-docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
GEOFABRIK_QUERY_URL: "https://geocoding.geofabrik.de/${{ secrets.GEOFABRIK_API }}"
TEST_KEY: ${{ secrets.TEST_SECRET }}
TEST_ENVVAR: "https://geocoding.geofabrik.de/${{ secrets.TEST_SECRET }}"
TEST_STR: "https://geocoding.geofabrik.de/"

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -29,10 +34,11 @@ jobs:
- name: Workflow test
run: echo Smoke test

- name: Variable
run: echo "$TEST_KEY"


- name: Test nominatim
run: docker-compose -f emission/integrationTests/docker-compose.yml up --exit-code-from web-server
env:
GEOFABRIK_QUERY_URL: "https://geocoding.geofabrik.de/${{ secrets.GEOFABRIK_API }}"
TEST_KEY: ${{ secrets.TEST_SECRET }}
TEST_ENVVAR: "https://geocoding.geofabrik.de/${{ secrets.TEST_SECRET }}"
TEST_STR: "https://geocoding.geofabrik.de/"


9 changes: 5 additions & 4 deletions emission/individual_tests/TestNominatim.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
import emission.analysis.intake.cleaning.clean_and_resample as clean

print("Starting to test Nominatim")
print("keys", os.environ.keys())
#temporarily sets NOMINATIM_QUERY_URL to the environment variable for testing.
NOMINATIM_QUERY_URL_env = os.environ.get("NOMINATIM_QUERY_URL", "")
NOMINATIM_QUERY_URL = NOMINATIM_QUERY_URL_env if NOMINATIM_QUERY_URL_env != "" else eco.NOMINATIM_QUERY_URL
GEOFABRIK_QUERY_URL = os.environ.get("GEOFABRIK_QUERY_URL")
TEST_2ENVVAR = os.environ.get("TEST_ENVVAR")
print("get method", TEST_2ENVVAR)
TEST_2KEY = os.environ.get("TEST_KEY")
print("get method key", TEST_2KEY)
TEST_ENVVAR = os.environ.get("TEST_ENVVAR")
TEST_KEY = os.environ.get("TEST_KEY")
TEST_STR = os.environ.get("TEST_STR")
print("Test str w envvar", TEST_ENVVAR)
print("Test key", TEST_KEY)
print("TESTSTRING", TEST_STR)
#Creates a fake place in Rhode Island to use for testing.
fake_id = "rhodeislander"
Expand Down

0 comments on commit 8f2c032

Please sign in to comment.