Skip to content

Commit

Permalink
Use six API keys in testing workflow instead of one (#687)
Browse files Browse the repository at this point in the history
* Add new API keys to wflow

* Debug print

* Better api key name formatting

* Fix wflow syntax

* Wflow syntax

* Fix setting env variable

* Fix echo command

* Fix debug print

* Fix echo again

* Fix echo again

* Fix string concat

* Change format command

* Try and fix echo again

* Print entire env

* Add echo

* Change echo again

* Another echo change

* Add missing echo

* Remove env setting

* Change github env output

* Set env variable again

* Fix windows env setting

* Remove env echo

* Ensure test failure after one fail
  • Loading branch information
munrojm committed Oct 7, 2022
1 parent 9f821a1 commit 25b21d8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/testing.yml
Expand Up @@ -69,19 +69,29 @@ jobs:
- name: Set SSL_CERT_FILE (Linux)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: export SSL_CERT_FILE=$(python -m certifi)
run: echo "SSL_CERT_FILE=$(python -m certifi)" >> $GITHUB_ENV

- name: Set SSL_CERT_FILE (Windows)
if: matrix.os == 'windows-latest'
run: echo ("SSL_CERT_FILE=" + $(python -m certifi)) >> $env:GITHUB_ENV
run: echo "SSL_CERT_FILE=$(python -m certifi)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append

- name: Format API key name (Linux/MacOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
echo "API_KEY_NAME=$(echo ${{ format('MP_API_KEY_{0}_{1}', matrix.os, matrix.python-version) }} | awk '{gsub(/-|\./, "_"); print}')" >> $GITHUB_ENV
- name: Format API key name (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "API_KEY_NAME=$(echo ${{ format('MP_API_KEY_{0}_{1}', matrix.os, matrix.python-version) }} | awk '{gsub(/-|\./, "_"); print}')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Test with pytest
env:
MP_API_KEY: ${{ secrets.MP_API_KEY }}
MP_API_KEY: ${{ secrets[env.API_KEY_NAME] }}
#MP_API_ENDPOINT: https://api-preview.materialsproject.org/
run: |
pip install -e .
pytest --cov=mp_api --cov-report=xml
pytest -x --cov=mp_api --cov-report=xml
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down

0 comments on commit 25b21d8

Please sign in to comment.