test_cortexlink.py #20
This file contains 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: Python Package CI | |
# Trigger the workflow on push or pull request to the main branch | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# Set a generous timeout for the job to prevent premature cancellation. | |
timeout-minutes: 20 # Set a longer timeout of 20 minutes | |
strategy: | |
matrix: | |
# Use only valid Python versions. | |
python-version: [3.8, 3.9] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 # Checkout the repository code | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 # Set up Python based on the version defined in the matrix | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
echo "Installing dependencies..." | |
python -m pip install --upgrade pip | |
pip install googlesearch-python colorama tabulate | |
echo "Dependencies installed successfully." | |
- name: Install flake8 | |
run: | | |
echo "Installing flake8..." | |
pip install flake8 | |
echo "flake8 installed successfully." | |
- name: Lint with flake8 | |
run: | | |
echo "Starting flake8 linting..." | |
flake8 --config .flake8 CortexLink.py || true # Ensure flake8 errors don't stop the build | |
echo "flake8 linting completed." | |
- name: Run tests | |
run: | | |
echo "No tests available" | |
# Ensure cleanup happens gracefully in case of an error or cancellation | |
- name: Post-job cleanup | |
if: always() | |
run: | | |
echo "Cleaning up post-job..." |