Skip to content

hotfix

hotfix #40

Workflow file for this run

name: ML Project Test

Check failure on line 1 in .github/workflows/notebook-test.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/notebook-test.yml

Invalid workflow file

(Line: 11, Col: 24): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITEA_ACTIONS == 'true' && '1' || '', (Line: 12, Col: 24): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITEA_ACTIONS == 'true' && '1' || '', (Line: 13, Col: 29): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITEA_ACTIONS == 'true' && '1' || '', (Line: 14, Col: 31): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITEA_ACTIONS == 'true' && '1' || '', (Line: 15, Col: 28): Unrecognized named-value: 'env'. Located at position 1 within expression: env.GITEA_ACTIONS == 'true' && '1' || ''
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
env:
# Conditionally set thread limits only for Gitea runners to prevent resource exhaustion.
# These are set to '1' if on Gitea, otherwise they are empty and have no effect.
OMP_NUM_THREADS: ${{ env.GITEA_ACTIONS == 'true' && '1' || '' }}
MKL_NUM_THREADS: ${{ env.GITEA_ACTIONS == 'true' && '1' || '' }}
OPENBLAS_NUM_THREADS: ${{ env.GITEA_ACTIONS == 'true' && '1' || '' }}
VECLIB_MAXIMUM_THREADS: ${{ env.GITEA_ACTIONS == 'true' && '1' || '' }}
NUMEXPR_NUM_THREADS: ${{ env.GITEA_ACTIONS == 'true' && '1' || '' }}
DEBIAN_FRONTEND: noninteractive
steps:
- name: Check out repository
uses: actions/checkout@v4
- 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/