Skip to content

Commit

Permalink
update ci testing noxfile to create api key file
Browse files Browse the repository at this point in the history
  • Loading branch information
gantian127 committed Oct 24, 2024
1 parent a0ea932 commit e984f35
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# - name: API Key File
# shell: bash
# env:
# CDS_API_KEY: ${{secrets.CDS_API_KEY}}
# run: |
# echo "https://cds.climate.copernicus.eu/api" >> .cdsapirc
# echo key: $CDS_API_KEY >> .cdsapirc
# cat .cdsapirc
# cp .cdsapirc ~/
# cp .cdsapirc ./notebooks
# cp .cdsapirc ./tests
# ls -a ~
# ls -a

- name: Test
env:
CDS_API_KEY: ${{secrets.CDS_API_KEY}}
Expand Down
9 changes: 1 addition & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,15 @@ def test(session: nox.Session) -> None:
"""Run the tests."""
session.install(".[testing]")



print(os.environ.get("CDS_API_KEY"))
# create API key file for ERA5 (need GitHub secret)
url = "https://cds.climate.copernicus.eu/api"
key = os.environ.get("CDS_API_KEY")
config_content = f"url: {url} \nkey: {key}"
home_dir = os.path.expanduser("~")
config_path = os.path.join(home_dir, ".cdsapirc")

with open(config_path, "w") as config_file:
config_file.write(config_content)

print(os.path.isdir(config_path))
print(config_path)
print(config_content)

args = ["--cov", PROJECT, "-vvv"] + session.posargs

if "CI" in os.environ:
Expand Down

0 comments on commit e984f35

Please sign in to comment.