Skip to content

Merge branch 'devin/1734933494-revert-conda-channel-url' into feature… #60

Merge branch 'devin/1734933494-revert-conda-channel-url' into feature…

Merge branch 'devin/1734933494-revert-conda-channel-url' into feature… #60

Workflow file for this run

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: Install and Configure Conda-Libmamba-Solver
shell: bash -l {0}
timeout-minutes: 5
run: |
echo "=== Installing conda-libmamba-solver ==="
# Update conda in base environment
conda update -n base conda -y
# Install conda-libmamba-solver
conda install -n base conda-libmamba-solver -y
# Verify installation
conda list conda-libmamba-solver
echo "=== Finished installing conda-libmamba-solver ==="
- name: Configure Conda Environment
shell: bash -l {0}
timeout-minutes: 10 # Combined timeout for all conda configuration
run: |
echo "=== Starting conda configuration ==="
# Configure conda settings
echo "Configuring conda settings..."
conda config --set solver libmamba
conda config --set channel_priority strict
conda config --set remote_max_retries 5
conda config --set remote_connect_timeout_secs 30
# Configure channels with correct URLs
conda config --add channels defaults
conda config --add channels conda-forge
# Verify configuration
echo "=== Conda Configuration ==="
conda config --show solver
conda config --show channels
conda info
echo "=== Finished conda configuration ==="
- 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