Skip to content

Update run-nsc.yml, some updates to dc logs #47

Update run-nsc.yml, some updates to dc logs

Update run-nsc.yml, some updates to dc logs #47

Workflow file for this run

name: Build Nabla Workflow
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: push-lock-${{ github.ref }}
cancel-in-progress: true
jobs:
build-windows:
runs-on: windows-2022
env:
image: ghcr.io/devsh-graphics-programming/docker-nanoserver-msvc-winsdk
entry: pwsh.exe
cmd: -NoLogo -NoProfile -ExecutionPolicy Bypass
mount: C:\mount\nabla
binary: C:\mount\nabla\build-ct
install: build-ct\install
strategy:
fail-fast: false
matrix:
# vendor: [msvc, clangcl]
# TODO: Yas please fix ClangCL, we have a few new compile errors
# if we build MSVC then build "run-compiler-explorer" target, for ClangCL build just "nsc"
vendor: [msvc]
config: [Release, Debug, RelWithDebInfo]
tag: ['17.13.6']
steps:
- name: Environment Setup
run: |
Add-MpPreference -ExclusionPath "${{ github.workspace }}"
Add-MpPreference -ExclusionExtension "*.*"
Add-MpPreference -ExclusionProcess "docker.exe"
Add-MpPreference -ExclusionProcess "dockerd.exe"
Set-MpPreference -RemediationScheduleDay 8
Set-MpPreference -DisableRealtimeMonitoring $true
Set-MpPreference -DisableRemovableDriveScanning $true
Set-MpPreference -DisableArchiveScanning $true
Set-MpPreference -DisableScanningMappedNetworkDrivesForFullScan $true
if (-not (docker network ls --format '{{.Name}}' | Where-Object { $_ -eq 'docker_default' })) {
docker network create --driver nat docker_default
if ($LASTEXITCODE -ne 0) { exit 1 }
}
- name: Set prefix
id: set-prefix
shell: pwsh
run: |
$prefix = "run-windows-${{ matrix.tag }}-${{ matrix.vendor }}-${{ matrix.config }}"
$repo = $env:GITHUB_REPOSITORY
$tag = "nsc-godbolt-build-${{ matrix.vendor }}-${{ matrix.config }}-${{ matrix.tag }}"
$nscTargetTaggedImage = "ghcr.io/${repo}:${tag}".ToLower()
$nscTargetTaggedImageLatest = "ghcr.io/${repo}:nsc-godbolt-latest".ToLower()
$shouldPushImage = (
"${{ github.ref }}" -eq "refs/heads/master" -and
"${{ matrix.vendor }}" -eq "msvc" -and
"${{ matrix.config }}" -eq "Release"
)
Write-Host "::notice::Should push image? $shouldPushImage"
"prefix=$prefix" >> $env:GITHUB_OUTPUT
"nscTargetTaggedImage=$nscTargetTaggedImage" >> $env:GITHUB_OUTPUT
"nscTargetTaggedImageLatest=$nscTargetTaggedImageLatest" >> $env:GITHUB_OUTPUT
"shouldPushImage=$shouldPushImage" >> $env:GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Pull Image
run: |
docker pull "${{ env.image }}:${{ matrix.tag }}"
- name: Run Container
run: |
$ctx = docker context show
$dockerHost = (docker context inspect $ctx | ConvertFrom-Json).Endpoints.docker.Host
$pipeName = [regex]::Match($dockerHost, '/pipe/(?<n>.+)$').Groups['n'].Value
$pipeHost = "\\.\pipe\$pipeName"
docker run `
--entrypoint ${{ env.entry }} -di --isolation process `
--env-file .\docker\ci-windows.env `
--env-file .\docker\ninja.env `
--env "NSC_IMAGE_NAME=${{ steps.set-prefix.outputs.nscTargetTaggedImage }}" `
--name orphan --network docker_default `
-v "${{ github.workspace }}:${{ env.mount }}" `
-v "${pipeHost}:\\.\pipe\dockerd" -e "DOCKER_HOST=npipe:////./pipe/dockerd" `
-w "${{ env.mount }}" `
"${{ env.image }}:${{ matrix.tag }}" `
${{ env.cmd }}
- name: Inspect Container
run: |
docker inspect orphan
- name: Container – Unpack Packages
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} C:\unpack.ps1
- name: Container – Configure Project with CMake
run: |
mkdir profiling
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake `
--preset ci-configure-dynamic-${{ matrix.vendor }} `
--profiling-output=profiling/cmake-profiling.json `
--profiling-format=google-trace
- name: Container – Build NSC
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake --build `
--preset ci-build-dynamic-${{ matrix.vendor }} `
-t run-compiler-explorer --config ${{ matrix.config }}
- name: Container – Install NSC
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake --install `
${{ env.binary }} --config ${{ matrix.config }} `
--component Runtimes --prefix ${{ env.install }}
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command cmake --install `
${{ env.binary }} --config ${{ matrix.config }} `
--component Executables --prefix ${{ env.install }}
- name: Container – Save NSC Image
run: |
docker exec orphan `
${{ env.entry }} ${{ env.cmd }} -Command docker `
save ${{ steps.set-prefix.outputs.nscTargetTaggedImage }} | zstd -T0 -3 -f -o ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image.tar.zst
- name: Package left workflow artifacts
run: |
tar -cvf "${{ steps.set-prefix.outputs.prefix }}-profiling.tar" profiling
tar -cvf "${{ steps.set-prefix.outputs.prefix }}-install.tar" ${{ env.install }}
- name: Upload NSC Godbolt Image artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image
path: ${{ steps.set-prefix.outputs.prefix }}-nsc-godbolt-image.tar.zst
compression-level: 0
- name: Upload profiling artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-prefix.outputs.prefix }}-profiling
path: ${{ steps.set-prefix.outputs.prefix }}-profiling.tar
- name: Upload install artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set-prefix.outputs.prefix }}-install
path: ${{ steps.set-prefix.outputs.prefix }}-install.tar
- name: Login to GHCR
if: steps.set-prefix.outputs.shouldPushImage == 'True'
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u $env:GITHUB_ACTOR --password-stdin
- name: Tag Latest image
if: steps.set-prefix.outputs.shouldPushImage == 'True'
run: |
docker tag ${{ steps.set-prefix.outputs.nscTargetTaggedImage }} ${{ steps.set-prefix.outputs.nscTargetTaggedImageLatest }}
- name: Push images to GHCR
if: steps.set-prefix.outputs.shouldPushImage == 'True'
run: |
docker push ${{ steps.set-prefix.outputs.nscTargetTaggedImageLatest }}