test fixes #46
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: ML Project Test | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set environment variables | |
| run: | | |
| echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV | |
| if [[ "${{ vars.IS_GITEA }}" == "true" ]]; then | |
| echo "Setting thread limits for Gitea runner" | |
| echo "OMP_NUM_THREADS=1" >> $GITHUB_ENV | |
| echo "MKL_NUM_THREADS=1" >> $GITHUB_ENV | |
| echo "OPENBLAS_NUM_THREADS=1" >> $GITHUB_ENV | |
| echo "VECLIB_MAXIMUM_THREADS=1" >> $GITHUB_ENV | |
| echo "NUMEXPR_NUM_THREADS=1" >> $GITHUB_ENV | |
| fi | |
| - name: Install Act dependencies | |
| if: ${{ env.ACT }} | |
| run: | | |
| apt-get update && apt-get install sudo -y | |
| - name: Install CA cert tools and trust internal CA | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ca-certificates | |
| sudo update-ca-certificates | |
| - name: Install ping utility | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y iputils-ping | |
| - name: Set timezone to UTC | |
| run: | | |
| # Use sudo for all commands to ensure permissions in all runner environments | |
| sudo ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime | |
| echo "Etc/UTC" | sudo tee /etc/timezone | |
| sudo apt-get update | |
| sudo apt-get install -y tzdata | |
| sudo dpkg-reconfigure -f noninteractive tzdata | |
| - name: Install libgomp1 for LightGBM | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgomp1 | |
| - name: Install Python 3.10, Git, and set CA environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lsb-release software-properties-common gnupg curl git | |
| # Properly and securely add the GPG key for the deadsnakes PPA | |
| sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BA6932366A755776 | |
| sudo gpg --export BA6932366A755776 | sudo gpg --dearmor -o /usr/share/keyrings/deadsnakes-archive-keyring.gpg | |
| # Add the PPA repository, signed by the new key | |
| echo "deb [signed-by=/usr/share/keyrings/deadsnakes-archive-keyring.gpg] http://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/deadsnakes-ppa.list | |
| sudo apt-get update | |
| sudo apt-get install -y python3.10 python3.10-venv python3.10-distutils | |
| # Set Python 3.10 as default using symbolic links | |
| sudo ln -sf /usr/bin/python3.10 /usr/local/bin/python | |
| sudo ln -sf /usr/bin/python3.10 /usr/local/bin/python3 | |
| python --version | |
| # Set the certificate path for all subsequent steps in the job | |
| echo "SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt" >> $GITHUB_ENV | |
| echo "REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt" >> $GITHUB_ENV | |
| - name: Setup ML project | |
| run: | | |
| cd $GITHUB_WORKSPACE | |
| # Make install.sh executable if it isn't already | |
| chmod +x install.sh | |
| # Run the installation script | |
| ./install.sh | |
| - name: Debug virtual environment | |
| run: | | |
| VENV_PATH=$(find $GITHUB_WORKSPACE -type d -name "ml_grid_env") | |
| echo "VENV_PATH=$VENV_PATH" >> $GITHUB_ENV | |
| source "$VENV_PATH/bin/activate" | |
| which python | |
| python --version | |
| - name: Run tests | |
| run: | | |
| set -e | |
| cd $GITHUB_WORKSPACE | |
| source "$VENV_PATH/bin/activate" | |
| pytest --nbmake --nbmake-timeout=1200 notebooks/unit_test_synthetic.ipynb | |
| echo "Running Python unit tests..." | |
| pytest tests/ |