| author | |
| committer | |
| log | 7b68b76326a650fad4c20274601968d436920caf |
| tree | e564dca55f633c54f86dd4718b35ba0fbb93e730 |
| parent | 0973f3638917111ea09740d0346f1debefd5f9db |
4 files changed, 220 insertions(+), 108 deletions(-)
.github/workflows/ci.yaml+14-5| ... | @@ -2,9 +2,9 @@ name: ci | ... | @@ -2,9 +2,9 @@ name: ci |
| 2 | on: | 2 | on: |
| 3 | pull_request: | 3 | pull_request: |
| 4 | push: | 4 | push: |
| 5 | branches: | 5 | branches: |
| 6 | - master | 6 | - master |
| 7 | concurrency: | 7 | concurrency: |
| 8 | # Cancels pending runs when a PR gets updated. | 8 | # Cancels pending runs when a PR gets updated. |
| 9 | group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} | 9 | group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} |
| 10 | cancel-in-progress: true | 10 | cancel-in-progress: true |
| ... | @@ -55,15 +55,24 @@ jobs: | ... | @@ -55,15 +55,24 @@ jobs: |
| 55 | uses: actions/checkout@v3 | 55 | uses: actions/checkout@v3 |
| 56 | - name: Build and Test | 56 | - name: Build and Test |
| 57 | run: ci/aarch64-macos.sh | 57 | run: ci/aarch64-macos.sh |
| 58 | x86_64-windows: | 58 | x86_64-windows-debug: |
| 59 | runs-on: windows-latest | 59 | runs-on: windows-latest |
| 60 | env: | 60 | env: |
| 61 | ARCH: "x86_64" | ||
| 62 | steps: | ||
| 63 | - name: Checkout | ||
| 64 | uses: actions/checkout@v3 | ||
| 65 | - name: Build and Test | ||
| 66 | run: ci/x86_64-windows-debug.ps1 | ||
| 67 | x86_64-windows-release: | ||
| 68 | runs-on: windows-latest | ||
| 69 | env: | ||
| 61 | ARCH: "x86_64" | 70 | ARCH: "x86_64" |
| 62 | steps: | 71 | steps: |
| 63 | - name: Checkout | 72 | - name: Checkout |
| 64 | uses: actions/checkout@v3 | 73 | uses: actions/checkout@v3 |
| 65 | - name: Build and Test | 74 | - name: Build and Test |
| 66 | run: ci/x86_64-windows.ps1 | 75 | run: ci/x86_64-windows-release.ps1 |
| 67 | aarch64-windows: | 76 | aarch64-windows: |
| 68 | runs-on: [self-hosted, Windows, aarch64] | 77 | runs-on: [self-hosted, Windows, aarch64] |
| 69 | env: | 78 | env: |
ci/x86_64-windows-debug.ps1 created+103| ... | @@ -0,0 +1,103 @@ | ||
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | ||
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e" | ||
| 3 | $MCPU = "baseline" | ||
| 4 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | ||
| 5 | $PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | ||
| 6 | $ZIG = "$PREFIX_PATH\bin\zig.exe" | ||
| 7 | $ZIG_LIB_DIR = "$(Get-Location)\lib" | ||
| 8 | |||
| 9 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | ||
| 10 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" | ||
| 11 | |||
| 12 | Write-Output "Extracting..." | ||
| 13 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | ||
| 14 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") | ||
| 15 | |||
| 16 | function CheckLastExitCode { | ||
| 17 | if (!$?) { | ||
| 18 | exit 1 | ||
| 19 | } | ||
| 20 | return 0 | ||
| 21 | } | ||
| 22 | |||
| 23 | # Make the `zig version` number consistent. | ||
| 24 | # This will affect the `zig build` command below which uses `git describe`. | ||
| 25 | git config core.abbrev 9 | ||
| 26 | git fetch --tags | ||
| 27 | |||
| 28 | if ((git rev-parse --is-shallow-repository) -eq "true") { | ||
| 29 | git fetch --unshallow # `git describe` won't work on a shallow repo | ||
| 30 | } | ||
| 31 | |||
| 32 | Write-Output "Building from source..." | ||
| 33 | Remove-Item -Path 'build-debug' -Recurse -Force -ErrorAction Ignore | ||
| 34 | New-Item -Path 'build-debug' -ItemType Directory | ||
| 35 | Set-Location -Path 'build-debug' | ||
| 36 | |||
| 37 | # CMake gives a syntax error when file paths with backward slashes are used. | ||
| 38 | # Here, we use forward slashes only to work around this. | ||
| 39 | & cmake .. ` | ||
| 40 | -GNinja ` | ||
| 41 | -DCMAKE_INSTALL_PREFIX="stage3-debug" ` | ||
| 42 | -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" ` | ||
| 43 | -DCMAKE_BUILD_TYPE=Debug ` | ||
| 44 | -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" ` | ||
| 45 | -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" ` | ||
| 46 | -DZIG_TARGET_TRIPLE="$TARGET" ` | ||
| 47 | -DZIG_TARGET_MCPU="$MCPU" ` | ||
| 48 | -DZIG_STATIC=ON | ||
| 49 | CheckLastExitCode | ||
| 50 | |||
| 51 | ninja install | ||
| 52 | CheckLastExitCode | ||
| 53 | |||
| 54 | Write-Output "Main test suite..." | ||
| 55 | & "stage3-debug\bin\zig.exe" build test docs ` | ||
| 56 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 57 | --search-prefix "$PREFIX_PATH" ` | ||
| 58 | -Dstatic-llvm ` | ||
| 59 | -Dskip-non-native ` | ||
| 60 | -Denable-symlinks-windows | ||
| 61 | CheckLastExitCode | ||
| 62 | |||
| 63 | Write-Output "Testing Autodocs..." | ||
| 64 | & "stage3-debug\bin\zig.exe" test "..\lib\std\std.zig" ` | ||
| 65 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 66 | -femit-docs ` | ||
| 67 | -fno-emit-bin | ||
| 68 | CheckLastExitCode | ||
| 69 | |||
| 70 | Write-Output "Build behavior tests using the C backend..." | ||
| 71 | & "stage3-debug\bin\zig.exe" test ` | ||
| 72 | ..\test\behavior.zig ` | ||
| 73 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 74 | -I..\test ` | ||
| 75 | -I..\lib ` | ||
| 76 | -ofmt=c ` | ||
| 77 | -femit-bin="test_behavior.c" | ||
| 78 | CheckLastExitCode | ||
| 79 | |||
| 80 | & "stage3-debug\bin\zig.exe" build-obj ` | ||
| 81 | ..\lib\compiler_rt.zig ` | ||
| 82 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 83 | -ofmt=c ` | ||
| 84 | -OReleaseSmall ` | ||
| 85 | --name compiler_rt ` | ||
| 86 | -femit-bin="compiler_rt.c" ` | ||
| 87 | --pkg-begin build_options config.zig --pkg-end | ||
| 88 | CheckLastExitCode | ||
| 89 | |||
| 90 | Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | ||
| 91 | CheckLastExitCode | ||
| 92 | |||
| 93 | Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ` | ||
| 94 | -DevCmdArguments '-arch=x64 -no_logo' ` | ||
| 95 | -StartInPath $(Get-Location) | ||
| 96 | CheckLastExitCode | ||
| 97 | |||
| 98 | Write-Output "Build and run behavior tests with msvc..." | ||
| 99 | & cl.exe -I..\lib test_behavior.c compiler_rt.c /W3 /Z7 -link -nologo -debug -subsystem:console -entry:wWinMainCRTStartup kernel32.lib ntdll.lib vcruntime.lib libucrt.lib | ||
| 100 | CheckLastExitCode | ||
| 101 | |||
| 102 | & .\test_behavior.exe | ||
| 103 | CheckLastExitCode | ||
ci/x86_64-windows-release.ps1 created+103| ... | @@ -0,0 +1,103 @@ | ||
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | ||
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e" | ||
| 3 | $MCPU = "baseline" | ||
| 4 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | ||
| 5 | $PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | ||
| 6 | $ZIG = "$PREFIX_PATH\bin\zig.exe" | ||
| 7 | $ZIG_LIB_DIR = "$(Get-Location)\lib" | ||
| 8 | |||
| 9 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | ||
| 10 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" | ||
| 11 | |||
| 12 | Write-Output "Extracting..." | ||
| 13 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | ||
| 14 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") | ||
| 15 | |||
| 16 | function CheckLastExitCode { | ||
| 17 | if (!$?) { | ||
| 18 | exit 1 | ||
| 19 | } | ||
| 20 | return 0 | ||
| 21 | } | ||
| 22 | |||
| 23 | # Make the `zig version` number consistent. | ||
| 24 | # This will affect the `zig build` command below which uses `git describe`. | ||
| 25 | git config core.abbrev 9 | ||
| 26 | git fetch --tags | ||
| 27 | |||
| 28 | if ((git rev-parse --is-shallow-repository) -eq "true") { | ||
| 29 | git fetch --unshallow # `git describe` won't work on a shallow repo | ||
| 30 | } | ||
| 31 | |||
| 32 | Write-Output "Building from source..." | ||
| 33 | Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore | ||
| 34 | New-Item -Path 'build-release' -ItemType Directory | ||
| 35 | Set-Location -Path 'build-release' | ||
| 36 | |||
| 37 | # CMake gives a syntax error when file paths with backward slashes are used. | ||
| 38 | # Here, we use forward slashes only to work around this. | ||
| 39 | & cmake .. ` | ||
| 40 | -GNinja ` | ||
| 41 | -DCMAKE_INSTALL_PREFIX="stage3-release" ` | ||
| 42 | -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" ` | ||
| 43 | -DCMAKE_BUILD_TYPE=Release ` | ||
| 44 | -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" ` | ||
| 45 | -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" ` | ||
| 46 | -DZIG_TARGET_TRIPLE="$TARGET" ` | ||
| 47 | -DZIG_TARGET_MCPU="$MCPU" ` | ||
| 48 | -DZIG_STATIC=ON | ||
| 49 | CheckLastExitCode | ||
| 50 | |||
| 51 | ninja install | ||
| 52 | CheckLastExitCode | ||
| 53 | |||
| 54 | Write-Output "Main test suite..." | ||
| 55 | & "stage3-release\bin\zig.exe" build test docs ` | ||
| 56 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 57 | --search-prefix "$PREFIX_PATH" ` | ||
| 58 | -Dstatic-llvm ` | ||
| 59 | -Dskip-non-native ` | ||
| 60 | -Denable-symlinks-windows | ||
| 61 | CheckLastExitCode | ||
| 62 | |||
| 63 | Write-Output "Testing Autodocs..." | ||
| 64 | & "stage3-release\bin\zig.exe" test "..\lib\std\std.zig" ` | ||
| 65 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 66 | -femit-docs ` | ||
| 67 | -fno-emit-bin | ||
| 68 | CheckLastExitCode | ||
| 69 | |||
| 70 | Write-Output "Build behavior tests using the C backend..." | ||
| 71 | & "stage3-release\bin\zig.exe" test ` | ||
| 72 | ..\test\behavior.zig ` | ||
| 73 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 74 | -I..\test ` | ||
| 75 | -I..\lib ` | ||
| 76 | -ofmt=c ` | ||
| 77 | -femit-bin="test_behavior.c" | ||
| 78 | CheckLastExitCode | ||
| 79 | |||
| 80 | & "stage3-release\bin\zig.exe" build-obj ` | ||
| 81 | ..\lib\compiler_rt.zig ` | ||
| 82 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 83 | -ofmt=c ` | ||
| 84 | -OReleaseSmall ` | ||
| 85 | --name compiler_rt ` | ||
| 86 | -femit-bin="compiler_rt.c" ` | ||
| 87 | --pkg-begin build_options config.zig --pkg-end | ||
| 88 | CheckLastExitCode | ||
| 89 | |||
| 90 | Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | ||
| 91 | CheckLastExitCode | ||
| 92 | |||
| 93 | Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ` | ||
| 94 | -DevCmdArguments '-arch=x64 -no_logo' ` | ||
| 95 | -StartInPath $(Get-Location) | ||
| 96 | CheckLastExitCode | ||
| 97 | |||
| 98 | Write-Output "Build and run behavior tests with msvc..." | ||
| 99 | & cl.exe -I..\lib test_behavior.c compiler_rt.c /W3 /Z7 -link -nologo -debug -subsystem:console -entry:wWinMainCRTStartup kernel32.lib ntdll.lib vcruntime.lib libucrt.lib | ||
| 100 | CheckLastExitCode | ||
| 101 | |||
| 102 | & .\test_behavior.exe | ||
| 103 | CheckLastExitCode | ||
ci/x86_64-windows.ps1 deleted-103| ... | @@ -1,103 +0,0 @@ | ||
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | ||
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e" | ||
| 3 | $MCPU = "baseline" | ||
| 4 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | ||
| 5 | $PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | ||
| 6 | $ZIG = "$PREFIX_PATH\bin\zig.exe" | ||
| 7 | $ZIG_LIB_DIR = "$(Get-Location)\lib" | ||
| 8 | |||
| 9 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | ||
| 10 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" | ||
| 11 | |||
| 12 | Write-Output "Extracting..." | ||
| 13 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | ||
| 14 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") | ||
| 15 | |||
| 16 | function CheckLastExitCode { | ||
| 17 | if (!$?) { | ||
| 18 | exit 1 | ||
| 19 | } | ||
| 20 | return 0 | ||
| 21 | } | ||
| 22 | |||
| 23 | # Make the `zig version` number consistent. | ||
| 24 | # This will affect the `zig build` command below which uses `git describe`. | ||
| 25 | git config core.abbrev 9 | ||
| 26 | git fetch --tags | ||
| 27 | |||
| 28 | if ((git rev-parse --is-shallow-repository) -eq "true") { | ||
| 29 | git fetch --unshallow # `git describe` won't work on a shallow repo | ||
| 30 | } | ||
| 31 | |||
| 32 | Write-Output "Building from source..." | ||
| 33 | Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore | ||
| 34 | New-Item -Path 'build-release' -ItemType Directory | ||
| 35 | Set-Location -Path 'build-release' | ||
| 36 | |||
| 37 | # CMake gives a syntax error when file paths with backward slashes are used. | ||
| 38 | # Here, we use forward slashes only to work around this. | ||
| 39 | & cmake .. ` | ||
| 40 | -GNinja ` | ||
| 41 | -DCMAKE_INSTALL_PREFIX="stage3-release" ` | ||
| 42 | -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" ` | ||
| 43 | -DCMAKE_BUILD_TYPE=Release ` | ||
| 44 | -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" ` | ||
| 45 | -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" ` | ||
| 46 | -DZIG_TARGET_TRIPLE="$TARGET" ` | ||
| 47 | -DZIG_TARGET_MCPU="$MCPU" ` | ||
| 48 | -DZIG_STATIC=ON | ||
| 49 | CheckLastExitCode | ||
| 50 | |||
| 51 | ninja install | ||
| 52 | CheckLastExitCode | ||
| 53 | |||
| 54 | Write-Output "Main test suite..." | ||
| 55 | & "stage3-release\bin\zig.exe" build test docs ` | ||
| 56 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 57 | --search-prefix "$PREFIX_PATH" ` | ||
| 58 | -Dstatic-llvm ` | ||
| 59 | -Dskip-non-native ` | ||
| 60 | -Denable-symlinks-windows | ||
| 61 | CheckLastExitCode | ||
| 62 | |||
| 63 | Write-Output "Testing Autodocs..." | ||
| 64 | & "stage3-release\bin\zig.exe" test "..\lib\std\std.zig" ` | ||
| 65 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 66 | -femit-docs ` | ||
| 67 | -fno-emit-bin | ||
| 68 | CheckLastExitCode | ||
| 69 | |||
| 70 | Write-Output "Build behaviour tests using the C backend..." | ||
| 71 | & "stage3-release\bin\zig.exe" test ` | ||
| 72 | ..\test\behavior.zig ` | ||
| 73 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 74 | -I..\test ` | ||
| 75 | -I..\lib ` | ||
| 76 | -ofmt=c ` | ||
| 77 | -femit-bin="test_behaviour.c" | ||
| 78 | CheckLastExitCode | ||
| 79 | |||
| 80 | & "stage3-release\bin\zig.exe" build-obj ` | ||
| 81 | ..\lib\compiler_rt.zig ` | ||
| 82 | --zig-lib-dir "$ZIG_LIB_DIR" ` | ||
| 83 | -ofmt=c ` | ||
| 84 | -OReleaseSmall ` | ||
| 85 | --name compiler_rt ` | ||
| 86 | -femit-bin="compiler_rt.c" ` | ||
| 87 | --pkg-begin build_options config.zig --pkg-end | ||
| 88 | CheckLastExitCode | ||
| 89 | |||
| 90 | Import-Module "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | ||
| 91 | CheckLastExitCode | ||
| 92 | |||
| 93 | Enter-VsDevShell -VsInstallPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ` | ||
| 94 | -DevCmdArguments '-arch=x64 -no_logo' ` | ||
| 95 | -StartInPath $(Get-Location) | ||
| 96 | CheckLastExitCode | ||
| 97 | |||
| 98 | Write-Output "Build and run behaviour tests with msvc..." | ||
| 99 | & cl.exe -I..\lib test_behaviour.c compiler_rt.c /W3 /Z7 -link -nologo -debug -subsystem:console -entry:wWinMainCRTStartup kernel32.lib ntdll.lib vcruntime.lib libucrt.lib | ||
| 100 | CheckLastExitCode | ||
| 101 | |||
| 102 | & .\test_behaviour.exe | ||
| 103 | CheckLastExitCode | ||