From 6486f2f4cecc61210dfdecf15784e792a1535e12 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Wed, 17 May 2023 13:23:16 -0700 Subject: [PATCH 1/7] Add an actions workflow that launches on the cuda-windows images. --- .github/workflows/test_on_pull_request.yml | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/test_on_pull_request.yml diff --git a/.github/workflows/test_on_pull_request.yml b/.github/workflows/test_on_pull_request.yml new file mode 100644 index 0000000000..deb093ef39 --- /dev/null +++ b/.github/workflows/test_on_pull_request.yml @@ -0,0 +1,38 @@ +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: + build-and-test: + name: "Build and test libcudacxx" + runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + version: [2017, 2019, 2022] + stdver: ['c++14', 'c++17', 'c++20'] + steps: + - name: Checkout ${{ github.repository }} + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Log in to registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + + - name: "Build config: VS${{ matrix.version }} + ${{ matrix.stdver }}" + uses: ./.github/actions/build-and-test-windows + with: + windows_url: ghcr.io/${{ github.repository_owner }}/cuda-windows-images:windows-server-cuda-msvc-${{ matrix.version }} + dialect: "${{ matrix.stdver }}" From 6a085dc926420aea1239cc8f420dccd0e78b869e Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Wed, 17 May 2023 14:36:09 -0700 Subject: [PATCH 2/7] Clean up .gitignore --- .gitignore | 45 +++++++-------------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 4c38aea682..7ec5249d0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,43 +1,12 @@ -samples/trie -samples/trie.exe +.cache +.clangd/ .vscode/* -samples/pg996.txt -samples/1342-0.txt -samples/2600-0.txt -samples/2701-0.txt -samples/35-0.txt -samples/84-0.txt -samples/8800.txt -samples/pg1727.txt -samples/pg55.txt -samples/pg6130.txt -samples/log.txt -samples/trie.exp -samples/trie.lib -samples/trie.txt -samples/out.txt -samples/temp.txt -samples/trie.cu.txt -samples/trie_mt.exe -samples/trie.obj -samples/trie_mt.obj -samples/trie_st.exe -samples/trie_st.obj -samples/trial -samples/trie_st -samples/trie_mt -samples/rtc -samples/benchmark *.pyc -build-*/ -build/ -.p4config -compare_git_to_perforce.bash *.log -.clangd/ -.cache -Output/ -compile_commands.json +*.obj *~ *lit_test_times.txt -llvm-project/ \ No newline at end of file +build/ +Output/ +compare_git_to_perforce.bash +compile_commands.json From d0bc14dd4fbb2b4afacdcb219ca9ad478a0ba3fe Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Wed, 17 May 2023 14:36:26 -0700 Subject: [PATCH 3/7] Add missing actions removed by .gitignore. --- .../actions/build-and-test-windows/action.ps1 | 32 +++++++++++++++++++ .../actions/build-and-test-windows/action.yml | 28 ++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/actions/build-and-test-windows/action.ps1 create mode 100644 .github/actions/build-and-test-windows/action.yml diff --git a/.github/actions/build-and-test-windows/action.ps1 b/.github/actions/build-and-test-windows/action.ps1 new file mode 100644 index 0000000000..ba02955b6c --- /dev/null +++ b/.github/actions/build-and-test-windows/action.ps1 @@ -0,0 +1,32 @@ +Param( + [Parameter(Mandatory=$true)] + [ValidateSet('c++14', 'c++17', 'c++20')] + [string[]] + $Dialect +) + +function TestReturnCode { + if (-not $?) { + throw 'Step Failed' + } +} + +$ErrorActionPreference = "Stop" +Push-location "$PSScriptRoot/../../.." + +try { + cmake -S ./ -B ../build -DCMAKE_CXX_COMPILER=cl -DCMAKE_CUDA_COMPILER=nvcc -G Ninja + TestReturnCode + + $ENV:LIBCUDACXX_SITE_CONFIG="$(Get-Location)/../build/test/lit.site.cfg" + + lit -v --no-progress-bar -o ./lit_test_results.json -Dcompute_archs=90 -Dexecutor="NoopExecutor()" -Dstd="$Dialect" .upstream-tests/test + TestReturnCode +} +catch { + Pop-Location + return 1; +} +finally { + Pop-Location +} diff --git a/.github/actions/build-and-test-windows/action.yml b/.github/actions/build-and-test-windows/action.yml new file mode 100644 index 0000000000..4528c7331f --- /dev/null +++ b/.github/actions/build-and-test-windows/action.yml @@ -0,0 +1,28 @@ +name: "Build libcudacxx on Windows" +description: "Builds wcow images with MSVC and CUDA" + +inputs: + windows_url: + type: string + required: true + description: Windows image to use for build + dialect: + type: string + required: true + description: Dialect to build and test. + +runs: + using: composite + steps: + + - name: "Fetch ${{ inputs.windows_url }}" + id: build + shell: powershell + run: docker pull ${{ inputs.windows_url }} + + - name: "Configure and test" + id: test + shell: powershell + run: | + docker run --mount type=bind,src=$(pwd),dst=C:\libcudacxx ${{ inputs.windows_url }} \ + "C:\libcudacxx\.github\actions\build-and-test-windows\action.ps1 -Dialect ${{ inputs.dialect }}" From 5a524d484a061187308730536467c430ec738a27 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Wed, 17 May 2023 14:38:39 -0700 Subject: [PATCH 4/7] Remove unsupported configurations from matrix. --- .github/workflows/test_on_pull_request.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test_on_pull_request.yml b/.github/workflows/test_on_pull_request.yml index deb093ef39..b086496af2 100644 --- a/.github/workflows/test_on_pull_request.yml +++ b/.github/workflows/test_on_pull_request.yml @@ -21,6 +21,11 @@ jobs: matrix: version: [2017, 2019, 2022] stdver: ['c++14', 'c++17', 'c++20'] + exclude: + - version: 2017 + stdver: 'c++20' + - version: 2019 + stdver: 'c++20' steps: - name: Checkout ${{ github.repository }} uses: actions/checkout@v3 From 2d50457eff2bf30ef12ca2b9a9312bf908133e0c Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Wed, 17 May 2023 14:53:37 -0700 Subject: [PATCH 5/7] Escapes in powershell are backticks. --- .github/actions/build-and-test-windows/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-and-test-windows/action.yml b/.github/actions/build-and-test-windows/action.yml index 4528c7331f..558e653778 100644 --- a/.github/actions/build-and-test-windows/action.yml +++ b/.github/actions/build-and-test-windows/action.yml @@ -24,5 +24,5 @@ runs: id: test shell: powershell run: | - docker run --mount type=bind,src=$(pwd),dst=C:\libcudacxx ${{ inputs.windows_url }} \ + docker run --mount type=bind,src=$(pwd),dst=C:\libcudacxx ${{ inputs.windows_url }} ` "C:\libcudacxx\.github\actions\build-and-test-windows\action.ps1 -Dialect ${{ inputs.dialect }}" From d88d3aee603c7e2a3b89dcf033947dd775b2b7f2 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Thu, 18 May 2023 22:44:24 -0700 Subject: [PATCH 6/7] Import dev prompt before testing. --- .github/actions/build-and-test-windows/action.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-and-test-windows/action.ps1 b/.github/actions/build-and-test-windows/action.ps1 index ba02955b6c..3298990f58 100644 --- a/.github/actions/build-and-test-windows/action.ps1 +++ b/.github/actions/build-and-test-windows/action.ps1 @@ -2,7 +2,7 @@ Param( [Parameter(Mandatory=$true)] [ValidateSet('c++14', 'c++17', 'c++20')] [string[]] - $Dialect + $dialect ) function TestReturnCode { @@ -14,13 +14,16 @@ function TestReturnCode { $ErrorActionPreference = "Stop" Push-location "$PSScriptRoot/../../.." +# This function is imported from a pre-loaded module +Get-VSDevPrompt + try { cmake -S ./ -B ../build -DCMAKE_CXX_COMPILER=cl -DCMAKE_CUDA_COMPILER=nvcc -G Ninja TestReturnCode $ENV:LIBCUDACXX_SITE_CONFIG="$(Get-Location)/../build/test/lit.site.cfg" - lit -v --no-progress-bar -o ./lit_test_results.json -Dcompute_archs=90 -Dexecutor="NoopExecutor()" -Dstd="$Dialect" .upstream-tests/test + lit -v --no-progress-bar -Dcompute_archs=90 -Dexecutor="NoopExecutor()" -Dstd="$dialect" .upstream-tests/test TestReturnCode } catch { From f1df75d220591f599c68c2ee2727498d9281f810 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Mon, 22 May 2023 21:13:20 -0700 Subject: [PATCH 7/7] Propagate script failure. --- .../actions/build-and-test-windows/action.ps1 | 19 +++++-------------- .github/workflows/test_on_pull_request.yml | 2 +- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/actions/build-and-test-windows/action.ps1 b/.github/actions/build-and-test-windows/action.ps1 index 3298990f58..2dad33ef7f 100644 --- a/.github/actions/build-and-test-windows/action.ps1 +++ b/.github/actions/build-and-test-windows/action.ps1 @@ -17,19 +17,10 @@ Push-location "$PSScriptRoot/../../.." # This function is imported from a pre-loaded module Get-VSDevPrompt -try { - cmake -S ./ -B ../build -DCMAKE_CXX_COMPILER=cl -DCMAKE_CUDA_COMPILER=nvcc -G Ninja - TestReturnCode +cmake -S ./ -B ../build -DCMAKE_CXX_COMPILER=cl -DCMAKE_CUDA_COMPILER=nvcc -G Ninja +TestReturnCode - $ENV:LIBCUDACXX_SITE_CONFIG="$(Get-Location)/../build/test/lit.site.cfg" +$ENV:LIBCUDACXX_SITE_CONFIG="$(Get-Location)/../build/test/lit.site.cfg" - lit -v --no-progress-bar -Dcompute_archs=90 -Dexecutor="NoopExecutor()" -Dstd="$dialect" .upstream-tests/test - TestReturnCode -} -catch { - Pop-Location - return 1; -} -finally { - Pop-Location -} +lit -v --no-progress-bar -Dcompute_archs=90 -Dexecutor="NoopExecutor()" -Dstd="$dialect" .upstream-tests/test +TestReturnCode diff --git a/.github/workflows/test_on_pull_request.yml b/.github/workflows/test_on_pull_request.yml index b086496af2..11cf6bd7d3 100644 --- a/.github/workflows/test_on_pull_request.yml +++ b/.github/workflows/test_on_pull_request.yml @@ -15,7 +15,7 @@ concurrency: jobs: build-and-test: name: "Build and test libcudacxx" - runs-on: windows-2019 + runs-on: windows-2022 strategy: fail-fast: false matrix: