Style: Fix trailing whitespace in workflow file #65
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 using Conda | |
on: | |
push: | |
branches: [ "main", "feature/*" ] | |
pull_request: | |
branches: [ "main", "feature/*" ] | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 # Set overall job timeout | |
env: | |
CONDA_CHANNEL_PRIORITY: "strict" | |
CONDA_SOLVER: "classic" # Using classic solver as approved | |
QT_QPA_PLATFORM: "offscreen" | |
LIBGL_ALWAYS_SOFTWARE: "1" | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Conda Environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: '3.10' | |
environment-file: environment.yml | |
auto-update-conda: true | |
activate-environment: quantum-sim | |
channel-priority: strict | |
channels: conda-forge,defaults | |
conda-solver: classic | |
- name: Install System Dependencies | |
run: | | |
# Dynamic package installation based on system type | |
if [ -x "$(command -v apt-get)" ]; then | |
echo "Installing dependencies on Debian-based system..." | |
sudo apt-get update -qq | |
sudo apt-get install -y libarchive-dev xvfb libgl1-mesa-dev libxkbcommon-x11-0 \ | |
libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \ | |
libxcb-xinerama0 libxcb-xfixes0 libglu1-mesa-dev freeglut3-dev | |
elif [ -x "$(command -v yum)" ]; then | |
echo "Installing dependencies on RHEL-based system..." | |
sudo yum install -y libarchive-devel mesa-libGL-devel | |
else | |
echo "Unsupported package manager. Please adjust the workflow accordingly." | |
exit 1 | |
fi | |
- name: Reset and Configure Conda Environment | |
shell: bash -l {0} | |
timeout-minutes: 10 | |
run: | | |
echo "=== Starting conda configuration ===" | |
# Remove any existing solver configuration | |
conda config --remove-key solver || true | |
# Configure conda settings | |
conda config --set solver classic | |
conda config --set channel_priority strict | |
conda config --set remote_max_retries 5 | |
conda config --set remote_connect_timeout_secs 30 | |
# Verify configuration | |
echo "=== Conda Configuration ===" | |
conda info | |
conda config --show-sources | |
conda config --show solver | |
conda config --show channels | |
echo "=== Finished conda configuration ===" | |
- name: Verify Solver Before Dependencies | |
shell: bash -l {0} | |
run: | | |
echo "=== Verifying solver configuration ===" | |
current_solver=$(conda config --show solver | grep -oP '(?<=solver: )\w+' || echo "not set") | |
if [ "$current_solver" != "classic" ]; then | |
echo "Error: Solver is not set to classic (current: $current_solver)" | |
exit 1 | |
fi | |
echo "Solver verified as classic" | |
- name: Install Python Dependencies | |
shell: bash -l {0} | |
run: | | |
conda env update --file environment.yml --name quantum-sim | |
conda list flake8 | |
- name: Lint with flake8 | |
shell: bash -l {0} | |
run: | | |
# Verify flake8 installation and location | |
which flake8 | |
# Run strict linting checks | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# Run additional style checks | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
# Generate detailed lint report | |
flake8 . --format=pylint --output-file=./lint-report.txt || true | |
- name: Upload Lint Report | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: lint-report | |
path: ./lint-report.txt | |
retention-days: 14 | |
- name: Test with pytest | |
shell: bash -l {0} | |
env: | |
PYTHONPATH: ${{ github.workspace }} | |
run: | | |
# Run tests with xvfb for GUI components | |
xvfb-run -a pytest tests/test_quantum_visualization.py -v |