| author | |
| committer | |
| log | bbd0775d777324636f7427496b5d9a3137db93d1 |
| tree | b638b96ffcf8bfa3c13cbba1d9c1d7a651f35b6b |
| parent | 7eed028f9a538624b90279aa430f6e136a77f6a2 |
4 files changed, 250 insertions(+), 0 deletions(-)
.github/workflows/ci.yaml created+53| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | name: push_ci | |
| 2 | run-name: Push CI | |
| 3 | on: | |
| 4 | push: | |
| 5 | branches: | |
| 6 | - master | |
| 7 | jobs: | |
| 8 | # linux: | |
| 9 | # runs-on: [self-hosted, Linux, aarch64] | |
| 10 | # env: | |
| 11 | # ARCH: "aarch64" | |
| 12 | # steps: | |
| 13 | # - name: Checkout | |
| 14 | # uses: actions/checkout@v3 | |
| 15 | ||
| 16 | # - name: Test | |
| 17 | # run: echo "Success!" | |
| 18 | # - name: Run Build Script | |
| 19 | # run: sh ./ci/linux/build.sh | |
| 20 | macos-x86_64: | |
| 21 | strategy: | |
| 22 | matrix: | |
| 23 | version: ["11", "12"] | |
| 24 | runs-on: "macos-${{ matrix.version }}" | |
| 25 | env: | |
| 26 | ARCH: "x86_64" | |
| 27 | MACOS_VERSION: ${{ matrix.version }} | |
| 28 | steps: | |
| 29 | - name: Checkout | |
| 30 | uses: actions/checkout@v3 | |
| 31 | ||
| 32 | - name: Run Build Script | |
| 33 | run: ./ci/macos/build.sh | |
| 34 | macos-aarch64: | |
| 35 | runs-on: [self-hosted, macOS, aarch64] | |
| 36 | env: | |
| 37 | ARCH: "aarch64" | |
| 38 | steps: | |
| 39 | - name: Checkout | |
| 40 | uses: actions/checkout@v3 | |
| 41 | ||
| 42 | - name: Run Build Script | |
| 43 | run: ./ci/macos/build.sh | |
| 44 | # windows: | |
| 45 | # runs-on: [self-hosted, Windows, x64] | |
| 46 | # env: | |
| 47 | # ARCH: "x86_64" | |
| 48 | # steps: | |
| 49 | # - name: Checkout | |
| 50 | # uses: actions/checkout@v3 | |
| 51 | ||
| 52 | # # - name: Run Build Script | |
| 53 | # # run: ./ci/windows/build.ps1 |
ci/linux/build.sh created+68| ... | ... | @@ -0,0 +1,68 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | ||
| 4 | # Requires cmake ninja-build | |
| 5 | ||
| 6 | set -x | |
| 7 | set -e | |
| 8 | ||
| 9 | ZIGDIR="$(pwd)" | |
| 10 | TARGET="$ARCH-linux-musl" | |
| 11 | MCPU="baseline" | |
| 12 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" | |
| 13 | PREFIX="$HOME/$CACHE_BASENAME" | |
| 14 | JOBS="-j2" | |
| 15 | ||
| 16 | rm -rf $PREFIX | |
| 17 | cd $HOME | |
| 18 | ||
| 19 | wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" | |
| 20 | tar xf "$CACHE_BASENAME.tar.xz" | |
| 21 | ||
| 22 | ZIG="$PREFIX/bin/zig" | |
| 23 | ||
| 24 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 25 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 26 | export PATH=$DEPS_LOCAL/bin:$PATH | |
| 27 | ||
| 28 | mkdir build-release | |
| 29 | cd build-release | |
| 30 | cmake .. \ | |
| 31 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 32 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 33 | -DCMAKE_BUILD_TYPE=Release \ | |
| 34 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 35 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 36 | -DZIG_STATIC=ON \ | |
| 37 | -GNinja | |
| 38 | ||
| 39 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 40 | # so that installation and testing do not get affected by them. | |
| 41 | unset CC | |
| 42 | unset CXX | |
| 43 | ||
| 44 | ninja install | |
| 45 | ||
| 46 | stage3-release/bin/zig build test docs \ | |
| 47 | -fqemu \ | |
| 48 | -fwasmtime \ | |
| 49 | -Dstatic-llvm \ | |
| 50 | -Dtarget=native-native-musl \ | |
| 51 | --search-prefix "$PREFIX" \ | |
| 52 | --zig-lib-dir "$(pwd)/../lib" | |
| 53 | ||
| 54 | # Produce the experimental std lib documentation. | |
| 55 | mkdir -p "stage3-release/doc/std" | |
| 56 | stage3-release/bin/zig test ../lib/std/std.zig \ | |
| 57 | -femit-docs=stage3-release/doc/std \ | |
| 58 | -fno-emit-bin \ | |
| 59 | --zig-lib-dir "$(pwd)/../lib" | |
| 60 | ||
| 61 | # cp ../LICENSE $RELEASE_STAGING/ | |
| 62 | # cp ../zig-cache/langref.html $RELEASE_STAGING/doc/ | |
| 63 | ||
| 64 | # # Look for HTML errors. | |
| 65 | # tidy --drop-empty-elements no -qe $RELEASE_STAGING/doc/langref.html | |
| 66 | ||
| 67 | # Explicit exit helps show last command duration. | |
| 68 | exit | |
| \ No newline at end of file |
ci/macos/build.sh created+65| ... | ... | @@ -0,0 +1,65 @@ |
| 1 | #!/bin/sh | |
| 2 | ||
| 3 | set -x | |
| 4 | set -e | |
| 5 | ||
| 6 | echo "Running on Version:" $MACOS_VERSION | |
| 7 | ||
| 8 | # Script assumes the presence of the following: | |
| 9 | # s3cmd | |
| 10 | ||
| 11 | ZIGDIR="$(pwd)" | |
| 12 | TARGET="$ARCH-macos-none" | |
| 13 | MCPU="baseline" | |
| 14 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" | |
| 15 | PREFIX="$HOME/$CACHE_BASENAME" | |
| 16 | JOBS="-j2" | |
| 17 | ||
| 18 | rm -rf $PREFIX | |
| 19 | cd $HOME | |
| 20 | ||
| 21 | curl -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" | |
| 22 | tar xf "$CACHE_BASENAME.tar.xz" | |
| 23 | ||
| 24 | ZIG="$PREFIX/bin/zig" | |
| 25 | export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" | |
| 26 | export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" | |
| 27 | ||
| 28 | cd $ZIGDIR | |
| 29 | ||
| 30 | # Make the `zig version` number consistent. | |
| 31 | # This will affect the cmake command below. | |
| 32 | git config core.abbrev 9 | |
| 33 | git fetch --unshallow || true | |
| 34 | git fetch --tags | |
| 35 | ||
| 36 | mkdir build | |
| 37 | cd build | |
| 38 | cmake .. \ | |
| 39 | -DCMAKE_INSTALL_PREFIX="stage3-release" \ | |
| 40 | -DCMAKE_PREFIX_PATH="$PREFIX" \ | |
| 41 | -DCMAKE_BUILD_TYPE=Release \ | |
| 42 | -DZIG_TARGET_TRIPLE="$TARGET" \ | |
| 43 | -DZIG_TARGET_MCPU="$MCPU" \ | |
| 44 | -DZIG_STATIC=ON | |
| 45 | ||
| 46 | # Now cmake will use zig as the C/C++ compiler. We reset the environment variables | |
| 47 | # so that installation and testing do not get affected by them. | |
| 48 | unset CC | |
| 49 | unset CXX | |
| 50 | ||
| 51 | make $JOBS install | |
| 52 | ||
| 53 | stage3-release/bin/zig build test docs \ | |
| 54 | --zig-lib-dir "$(pwd)/../lib" \ | |
| 55 | -Denable-macos-sdk \ | |
| 56 | -Dstatic-llvm \ | |
| 57 | -Dskip-non-native \ | |
| 58 | --search-prefix "$PREFIX" | |
| 59 | ||
| 60 | # Produce the experimental std lib documentation. | |
| 61 | mkdir -p "stage3-release/doc/std" | |
| 62 | stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \ | |
| 63 | --zig-lib-dir "$(pwd)/../lib" \ | |
| 64 | -femit-docs="$(pwd)/stage3-release/doc/std" \ | |
| 65 | -fno-emit-bin | |
| \ No newline at end of file |
ci/windows/build.ps1 created+64| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | $TARGET = "$($Env:ARCH)-windows-gnu" | |
| 2 | $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.25+499dddb4c" | |
| 3 | $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 4 | ||
| 5 | Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" | |
| 6 | ||
| 7 | Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" | |
| 8 | ||
| 9 | Write-Output "Extracting..." | |
| 10 | ||
| 11 | Add-Type -AssemblyName System.IO.Compression.FileSystem ; | |
| 12 | [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") | |
| 13 | ||
| 14 | Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib" | |
| 15 | Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release" | |
| 16 | Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" | |
| 17 | ||
| 18 | function CheckLastExitCode { | |
| 19 | if (!$?) { | |
| 20 | exit 1 | |
| 21 | } | |
| 22 | return 0 | |
| 23 | } | |
| 24 | ||
| 25 | # Make the `zig version` number consistent. | |
| 26 | # This will affect the `zig build` command below which uses `git describe`. | |
| 27 | git config core.abbrev 9 | |
| 28 | git fetch --tags | |
| 29 | ||
| 30 | if ((git rev-parse --is-shallow-repository) -eq "true") { | |
| 31 | git fetch --unshallow # `git describe` won't work on a shallow repo | |
| 32 | } | |
| 33 | ||
| 34 | Write-Output "Building Zig..." | |
| 35 | ||
| 36 | & "$ZIGPREFIXPATH\bin\zig.exe" build ` | |
| 37 | --prefix "$ZIGINSTALLDIR" ` | |
| 38 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 39 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 40 | -Denable-stage1 ` | |
| 41 | -Dstatic-llvm ` | |
| 42 | -Drelease ` | |
| 43 | -Dstrip ` | |
| 44 | -Duse-zig-libcxx ` | |
| 45 | -Dtarget="$TARGET" | |
| 46 | CheckLastExitCode | |
| 47 | ||
| 48 | Write-Output " zig build test docs..." | |
| 49 | ||
| 50 | & "$ZIGINSTALLDIR\bin\zig.exe" build test docs ` | |
| 51 | --search-prefix "$ZIGPREFIXPATH" ` | |
| 52 | -Dstatic-llvm ` | |
| 53 | -Dskip-non-native | |
| 54 | CheckLastExitCode | |
| 55 | ||
| 56 | # Produce the experimental std lib documentation. | |
| 57 | mkdir "$ZIGINSTALLDIR\doc\std" -force | |
| 58 | ||
| 59 | Write-Output "zig test std/std.zig..." | |
| 60 | ||
| 61 | & "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" ` | |
| 62 | --zig-lib-dir "$ZIGLIBDIR" ` | |
| 63 | -femit-docs="$ZIGINSTALLDIR\doc\std" ` | |
| 64 | -fno-emit-bin |