feat: Add environment variable support for CLI arguments #469
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: test-script | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| OPENAI_API_KEY: "my-test-key" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -r requirements.dev.txt | |
| - name: Lint with flake8 | |
| run: flake8 --max-line-length=200 . | |
| continue-on-error: true | |
| - name: Type check with mypy | |
| run: | | |
| mypy structkit tests | |
| continue-on-error: true | |
| - name: Run tests | |
| env: | |
| REPORT_OUTPUT: md_report.md | |
| shell: bash | |
| run: | | |
| echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV" | |
| pytest --cov=structkit --cov-branch --cov-report=xml -v --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT" --pyargs tests | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Output reports to the job summary when tests fail | |
| if: failure() | |
| shell: bash | |
| run: | | |
| if [ -f "$REPORT_FILE" ]; then | |
| echo "<details><summary>Failed Test Report</summary>" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "</details>" >> $GITHUB_STEP_SUMMARY | |
| fi |