diff --git a/.github/action-scripts/configure-vcvars.ps1 b/.github/action-scripts/configure-vcvars.ps1 new file mode 100644 index 0000000000..c6c7ae2246 --- /dev/null +++ b/.github/action-scripts/configure-vcvars.ps1 @@ -0,0 +1,20 @@ +$msvcPath = "$(vswhere -products * -latest -property installationPath)" + +Write-Output "Loading VC from: $msvcPath\VC\Auxiliary\Build" + +Push-Location "$msvcPath\VC\Auxiliary\Build" +cmd /c "vcvars64.bat & set" | + foreach { + if ($_ -match "=") { + $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" + echo "$($v[0])=$($v[1])" >> $ENV:GITHUB_ENV + } + } +Pop-Location + +# Stupid, but makes cl.exe happy +$global:CC_FP = $(get-command cl).Source.Replace("\","/") + +Write-Host "`nVisual Studio Command Prompt variables set." -ForegroundColor Yellow +Write-Host "Use `$CC_FP as shortcut for Cmake: $CC_FP" -ForegroundColor Yellow + diff --git a/.github/action-scripts/fetch-cuda.ps1 b/.github/action-scripts/fetch-cuda.ps1 new file mode 100644 index 0000000000..b57a9df61c --- /dev/null +++ b/.github/action-scripts/fetch-cuda.ps1 @@ -0,0 +1,9 @@ + +Invoke-WebRequest -Uri "https://developer.download.nvidia.com/compute/cuda/12.1.0/network_installers/cuda_12.1.0_windows_network.exe" -OutFile "./cuda_network.exe" +Start-Process -Wait -FilePath ./cuda_network.exe -ArgumentList "-s nvcc_12.1 cudart_12.1" + +$ENV:PATH="$ENV:PATH;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin" +$ENV:CUDA_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1" + +echo "PATH=$ENV:PATH" >> $ENV:GITHUB_ENV +echo "CUDA_PATH=$ENV:CUDA_PATH" >> $ENV:GITHUB_ENV diff --git a/.github/action-scripts/fetch-lit.ps1 b/.github/action-scripts/fetch-lit.ps1 new file mode 100644 index 0000000000..16fc65206a --- /dev/null +++ b/.github/action-scripts/fetch-lit.ps1 @@ -0,0 +1,7 @@ +$LIT_PATH = "$((gi $((gcm python).path)).Directory.FullName)\Scripts" + +python -m pip install wheel +python -m pip install lit + +$ENV:PATH="$ENV:PATH;$LIT_PATH" +echo "PATH=$ENV:PATH" >> $ENV:GITHUB_ENV diff --git a/.github/action-scripts/fetch-ninja.ps1 b/.github/action-scripts/fetch-ninja.ps1 new file mode 100644 index 0000000000..63f4748d52 --- /dev/null +++ b/.github/action-scripts/fetch-ninja.ps1 @@ -0,0 +1,6 @@ +# Fetch Ninja, this is a powershell step because of Expand-Archive +Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip" -OutFile "./ninja.zip" +Expand-Archive ./ninja.zip + +$ENV:PATH="$ENV:PATH;$(pwd)\ninja" +echo "PATH=$ENV:PATH" >> $ENV:GITHUB_ENV diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..aabc3023ac --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,47 @@ +on: + pull_request: + branches: + - main + +permissions: + contents: read + pull-requests: read + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + Lit-NoExecutor: + runs-on: windows-latest + steps: + - uses: actions/checkout@master + - uses: actions/setup-python@master + + - name: Install Lit + run: .github\action-scripts\fetch-lit.ps1 + + - name: Fetch CUDA Toolkit + run: .github\action-scripts\fetch-cuda.ps1 + + - name: Fetch Ninja + run: .github\action-scripts\fetch-ninja.ps1 + + - name: Set vcvars + run: .github\action-scripts\configure-vcvars.ps1 + + - name: Configure CMake project + run: | + echo "CUDA_PATH: $ENV:CUDA_PATH" + cmake -S ./ -B ../build -DLIBCUDACXX_ENABLE_LIBCUDACXX_TESTS=ON -DCMAKE_CXX_COMPILER=cl -DCMAKE_CUDA_COMPILER=nvcc -G Ninja + + - name: Build libcudacxx tests + run: | + $ENV:LIBCUDACXX_SITE_CONFIG="$(pwd)/../build/test/lit.site.cfg" + lit --no-progress-bar -o ./lit_test_results.json -Dcompute_archs=90 -Dexecutor="NoopExecutor()" -Dstd=c++20 -j3 .upstream-tests/test + + - uses: actions/upload-artifact@v3 + with: + name: lit_test_results.json + path: ./lit_test_results.json