Skip to content

Commit

Permalink
ci: only run pytest if secrets are accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutterley committed Sep 6, 2024
1 parent b4a1079 commit 7b91a02
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 316 deletions.
313 changes: 0 additions & 313 deletions .github/workflows/Dockerfile

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/python-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,25 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: "Check if repository secrets are accessible"
id: secrets
run: |
if [ "${{ secrets.MY_KEY }}" == '' ] ; then
echo "accessible=false" >> $GITHUB_OUTPUT;
echo "::debug::GitHub secrets unavailable for Actions";
else
echo "accessible=true" >> $GITHUB_OUTPUT;
echo "::debug::GitHub secrets available for Actions";
fi
- name: Checkout Matlab TMD Toolbox
if: steps.changes.secrets.accessible == 'true'
uses: actions/checkout@v4
with:
repository: EarthAndSpaceResearch/TMD_Matlab_Toolbox_v2.5
path: TMD_Matlab_Toolbox
ref: master
- name: Test with pytest
if: steps.changes.secrets.accessible == 'true'
run: |
pip install --no-deps .
pytest --verbose --capture=no --cov=./ --cov-report=xml \
Expand All @@ -70,6 +82,7 @@ jobs:
--aws-secret=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
--aws-region=${{ secrets.AWS_REGION_NAME }}
- name: Upload coverage to Codecov
if: steps.changes.secrets.accessible == 'true'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -80,6 +93,7 @@ jobs:
fail_ci_if_error: true
verbose: true
- name: Archive code coverage results
if: steps.changes.secrets.accessible == 'true'
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/update-provider-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ jobs:
id: changes
run: |
if [ -n "$(git status --porcelain)" ] ; then
echo "DETECTED=true" >> $GITHUB_OUTPUT;
echo "detected=true" >> $GITHUB_OUTPUT;
echo "::debug::Changes detected";
else
echo "DETECTED=false" >> $GITHUB_OUTPUT;
echo "detected=false" >> $GITHUB_OUTPUT;
echo "::debug::No changes detected";
fi
- name: Checkout PR and Push Changes
if: steps.changes.outputs.DETECTED == 'true'
if: steps.changes.outputs.detected == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down

0 comments on commit 7b91a02

Please sign in to comment.