Fix the import statement for testing LuccaAPI #79
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
| # This workflow installs dependencies, runs tests, and securely stores an API token. | |
| name: Python application | |
| on: | |
| push: | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| python-version: [3.10.0] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Lint with flake8 | |
| run: | | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| # Securely store API token in Windows Credential Manager | |
| - name: Store API Token in Windows Credential Manager | |
| shell: pwsh | |
| env: | |
| LUCCA_API_TOKEN: ${{ secrets.LUCCA_API_TOKEN }} | |
| run: | | |
| cmdkey /generic:MyLuccaToken /user:dummy /pass:$env:LUCCA_API_TOKEN | |
| echo "Token stored securely in Credential Manager." | |
| # Retrieve and use the token securely | |
| - name: Retrieve API Token | |
| shell: pwsh | |
| run: | | |
| $retrievedToken = cmdkey /list | Select-String "MyLuccaToken" | |
| if ($retrievedToken) { | |
| echo "Token successfully retrieved." | |
| } else { | |
| echo "Token not found." && exit 1 | |
| } | |
| # Run tests with pytest, assuming the Python script fetches the token securely | |
| - name: Test with pytest | |
| run: | | |
| pytest | |
| # Cleanup: Remove the API token after workflow execution | |
| - name: Remove API Token from Windows Credential Manager | |
| shell: pwsh | |
| run: | | |
| cmdkey /delete:MyLuccaToken |