refactor #63
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: GA Project Test | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies for local (act) runner | |
| if: ${{ env.ACT }} | |
| run: | | |
| apt-get update | |
| apt-get install -y sudo git curl gnupg | |
| - 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: Debug mounted cert | |
| continue-on-error: true | |
| run: ls -l /usr/local/share/ca-certificates && cat /usr/local/share/ca-certificates/kch_certauth.crt | |
| - 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 Python 3.10, Git, and set CA environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lsb-release | |
| # 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 | |
| # 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 GA project | |
| id: setup | |
| run: | | |
| chmod +x ./setup.sh | |
| # Use --cpu for CPU-only PyTorch and --dev to install testing tools like pytest | |
| ./setup.sh --cpu --dev | |
| - name: Run unit tests with pytest | |
| run: | | |
| # Activate the environment created by the setup script | |
| source ga_env/bin/activate | |
| pytest | |
| - name: Run tests | |
| env: | |
| CUDA_VISIBLE_DEVICES: "" | |
| run: | | |
| # Execute the example notebook with an increased timeout of 60 minutes (3600 seconds). | |
| # The default is 30s, which is often too short for ML experiments. | |
| ga_env/bin/jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=3600 notebooks/example_usage.ipynb --output executed_example_usage.ipynb |