build makefile script #3
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: Build with CUDA and C++ | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install CUDA and dependencies | |
run: | | |
# Add NVIDIA package repositories and key | |
sudo apt-get update | |
sudo apt-get install -y gnupg curl lsb-release | |
curl https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin | sudo tee /etc/apt/preferences.d/cuda-repository-pin-600 | |
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pub | sudo tee /etc/apt/trusted.gpg.d/cuda.asc | |
sudo apt-get update | |
# Install CUDA (make sure to choose the right version you need) | |
sudo apt-get install -y cuda-11-7 | |
# Install other necessary dependencies like build-essential | |
sudo apt-get install -y build-essential | |
# Verify that CUDA is installed | |
nvcc --version | |
g++ --version | |
- name: Build with Makefile | |
run: | | |
# Make sure the Makefile exists and then build the project | |
if [ -f makefile ]; then | |
make | |
else | |
echo "Makefile not found!" | |
exit 1 | |
fi | |
- name: Run tests (optional) | |
run: | | |
# Run tests if you have them defined | |
# Example: ./test_program | |
echo "No tests defined" | |