diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-02-17 16:16:33 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-02-17 23:42:46 -0700 |
| commit | 419074a81ba7d7111bae7d07af26aad9c7deeb1f (patch) | |
| tree | a84ac7699832e56585e18802ac14cb6eeda924a2 /ci | |
| parent | 2f42a2617b55c497bc13a44f64a921e6d2620acf (diff) | |
| download | zig-419074a81ba7d7111bae7d07af26aad9c7deeb1f.tar.gz zig-419074a81ba7d7111bae7d07af26aad9c7deeb1f.zip | |
CI: simplify linux script
* build.zig: remove detour through zig0. I'll add it back as an option
later. This means you can build stage1 with a freshly built zig
without detouring through zig0 again.
* remove unused file windows_script.bat
* drone.yml: remove unnecessary steps
* ninja doesn't need a jobs parameter
* build the release version of zig with zig build instead of cmake.
* build stage2 with -Dstatic-llvm -Duse-zig-libcxx
Diffstat (limited to 'ci')
| -rw-r--r-- | ci/azure/windows_script.bat | 8 | ||||
| -rw-r--r-- | ci/zinc/drone.yml | 12 | ||||
| -rwxr-xr-x | ci/zinc/linux_base.sh | 1 | ||||
| -rwxr-xr-x | ci/zinc/linux_build.sh | 72 | ||||
| -rwxr-xr-x | ci/zinc/linux_probe.sh | 10 | ||||
| -rwxr-xr-x | ci/zinc/linux_test.sh | 61 |
6 files changed, 58 insertions, 106 deletions
diff --git a/ci/azure/windows_script.bat b/ci/azure/windows_script.bat deleted file mode 100644 index 5002fce24b..0000000000 --- a/ci/azure/windows_script.bat +++ /dev/null @@ -1,8 +0,0 @@ -@echo on -SET "SRCROOT=%cd%" -SET "PREVPATH=%PATH%" -SET "PREVMSYSTEM=%MSYSTEM%" - -set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" -SET "MSYSTEM=MINGW64" -bash -lc "cd ${SRCROOT} && ci/azure/windows_script" || exit /b diff --git a/ci/zinc/drone.yml b/ci/zinc/drone.yml index d6fac279e1..cb105381ae 100644 --- a/ci/zinc/drone.yml +++ b/ci/zinc/drone.yml @@ -9,19 +9,7 @@ workspace: path: /workspace steps: -- name: probe - image: ci/debian-amd64:11.1-3 - commands: - - ./ci/zinc/linux_probe.sh - -- name: build - image: ci/debian-amd64:11.1-3 - commands: - - ./ci/zinc/linux_build.sh - - name: test - depends_on: - - build image: ci/debian-amd64:11.1-3 commands: - ./ci/zinc/linux_test.sh diff --git a/ci/zinc/linux_base.sh b/ci/zinc/linux_base.sh index 5d33e19e67..f1e9924258 100755 --- a/ci/zinc/linux_base.sh +++ b/ci/zinc/linux_base.sh @@ -17,7 +17,6 @@ set -x set -e ARCH="$(uname -m)" -JOBS="-j$(nproc)" DEPS_LOCAL="/deps/local" WORKSPACE="$DRONE_WORKSPACE" diff --git a/ci/zinc/linux_build.sh b/ci/zinc/linux_build.sh deleted file mode 100755 index 1d468bbd25..0000000000 --- a/ci/zinc/linux_build.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -. ./ci/zinc/linux_base.sh - -ZIG="$DEPS_LOCAL/bin/zig" -TARGET="${ARCH}-linux-musl" -MCPU="baseline" - -# Make the `zig version` number consistent. -# This will affect the cmake command below. -git config core.abbrev 9 - -# Build debug zig. -echo "BUILD debug zig with zig:$($ZIG version)" - -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" - -mkdir _debug -cd _debug -cmake .. \ - -DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \ - -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ - -DCMAKE_BUILD_TYPE=Debug \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -GNinja - -# Now cmake will use zig as the C/C++ compiler. We reset the environment variables -# so that installation and testing do not get affected by them. -unset CC -unset CXX - -ninja $JOBS install - -ZIG=$DEBUG_STAGING/bin/zig - -# Here we rebuild zig but this time using the Zig binary we just now produced to -# build zig1.o rather than relying on the one built with stage0. See -# https://github.com/ziglang/zig/issues/6830 for more details. -cmake .. -DZIG_EXECUTABLE="$ZIG" -ninja $JOBS install - -cd $WORKSPACE - -# Build release zig. -echo "BUILD release zig with zig:$($ZIG version)" -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" -mkdir _release -cd _release -cmake .. \ - -DCMAKE_INSTALL_PREFIX="$RELEASE_STAGING" \ - -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ - -DCMAKE_BUILD_TYPE=Release \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -GNinja -unset CC -unset CXX -ninja $JOBS install - -cd $WORKSPACE - -# Look for non-conforming code formatting. -# Formatting errors can be fixed by running `zig fmt` on the files printed here. -$ZIG fmt --check . - -# Explicit exit helps show last command duration. -exit diff --git a/ci/zinc/linux_probe.sh b/ci/zinc/linux_probe.sh deleted file mode 100755 index 7c7d6c52fe..0000000000 --- a/ci/zinc/linux_probe.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -. ./ci/zinc/linux_base.sh - -# Probe CPU/brand details. -echo "lscpu:" -(lscpu | sed 's,^, : ,') 1>&2 - -# Explicit exit helps show last command duration. -exit diff --git a/ci/zinc/linux_test.sh b/ci/zinc/linux_test.sh index 775d6b78b4..79b3174f15 100755 --- a/ci/zinc/linux_test.sh +++ b/ci/zinc/linux_test.sh @@ -2,10 +2,53 @@ . ./ci/zinc/linux_base.sh -ZIG=$DEBUG_STAGING/bin/zig +ZIG="$DEPS_LOCAL/bin/zig" +TARGET="${ARCH}-linux-musl" +MCPU="baseline" + +# Make the `zig version` number consistent. +# This will affect the cmake command below. +git config core.abbrev 9 + +echo "BUILD debug zig with zig:$($ZIG version)" + +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +mkdir _debug +cd _debug +cmake .. \ + -DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \ + -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +# Now cmake will use zig as the C/C++ compiler. We reset the environment variables +# so that installation and testing do not get affected by them. +unset CC +unset CXX + +ninja install + +ZIG="$DEBUG_STAGING/bin/zig" + +# Here we rebuild zig but this time using the Zig binary we just now produced to +# build zig1.o rather than relying on the one built with stage0. See +# https://github.com/ziglang/zig/issues/6830 for more details. +cmake .. -DZIG_EXECUTABLE="$ZIG" +ninja install + +cd $WORKSPACE + +# Look for non-conforming code formatting. +# Formatting errors can be fixed by running `zig fmt` on the files printed here. +$ZIG fmt --check . # Build stage2 standalone so that we can test stage2 against stage2 compiler-rt. -$ZIG build -p stage2 -Denable-llvm +$ZIG build -p stage2 -Denable-llvm -Dstatic-llvm -Duse-zig-libcxx stage2/bin/zig test test/behavior.zig -I test -fLLVM stage2/bin/zig test test/behavior.zig -I test @@ -38,7 +81,7 @@ $ZIG build test-fmt -fqemu -fwasmtime $ZIG build test-stage2 -fqemu -fwasmtime # Produce the experimental std lib documentation. -mkdir -p $RELEASE_STAGING/docs/std +mkdir -p "$RELEASE_STAGING/docs/std" $ZIG test lib/std/std.zig \ --zig-lib-dir lib \ -femit-docs=$RELEASE_STAGING/docs/std \ @@ -47,5 +90,17 @@ $ZIG test lib/std/std.zig \ # Look for HTML errors. tidy --drop-empty-elements no -qe zig-cache/langref.html +# Build release zig. +$ZIG build + --prefix "RELEASE_STAGING" \ + --search-prefix "$DEPS_LOCAL" \ + -Denable-llvm \ + -Dstatic-llvm \ + -Drelease \ + -Dstrip \ + -Duse-zig-libcxx \ + -Dtarget="$TARGET" \ + -Dstage1 + # Explicit exit helps show last command duration. exit |
