diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2021-11-08 04:08:29 -0500 |
|---|---|---|
| committer | Michael Dusan <michael.dusan@gmail.com> | 2021-11-08 13:45:03 -0500 |
| commit | a7d215759e93be971ba5e560578e7473655cdd82 (patch) | |
| tree | 90cdab59b25f38a72d28bdf02296952e13e54760 /ci | |
| parent | 3c7310f8cc164dbf6e6393392e8812c9f5b6a270 (diff) | |
| download | zig-a7d215759e93be971ba5e560578e7473655cdd82.tar.gz zig-a7d215759e93be971ba5e560578e7473655cdd82.zip | |
ci: fully activate ci.ziglang.org linux
- disable azure/linux
- split probe/build/test steps for log clarity
- add package step; enabled only when master/pull
- add on-master-success pipeline; enabled only when master/pull
Diffstat (limited to 'ci')
| -rwxr-xr-x | ci/azure/macos_script | 1 | ||||
| -rw-r--r-- | ci/azure/pipelines.yml | 14 | ||||
| -rw-r--r-- | ci/zinc/drone.yml | 59 | ||||
| -rwxr-xr-x | ci/zinc/linux_base.sh | 28 | ||||
| -rwxr-xr-x | ci/zinc/linux_build.sh | 101 | ||||
| -rwxr-xr-x | ci/zinc/linux_on_master_sucess.sh | 12 | ||||
| -rwxr-xr-x | ci/zinc/linux_package.sh | 40 | ||||
| -rwxr-xr-x | ci/zinc/linux_probe.sh | 10 | ||||
| -rwxr-xr-x | ci/zinc/linux_test.sh | 37 |
9 files changed, 195 insertions, 107 deletions
diff --git a/ci/azure/macos_script b/ci/azure/macos_script index 13e064f0e6..b320d4f21b 100755 --- a/ci/azure/macos_script +++ b/ci/azure/macos_script @@ -95,4 +95,5 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" + echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION" fi diff --git a/ci/azure/pipelines.yml b/ci/azure/pipelines.yml index f57ef14218..eea4d13c32 100644 --- a/ci/azure/pipelines.yml +++ b/ci/azure/pipelines.yml @@ -21,17 +21,6 @@ jobs: - script: ci/azure/macos_arm64_script name: main displayName: 'Build' -- job: BuildLinux - pool: - vmImage: 'ubuntu-18.04' - timeoutInMinutes: 360 - steps: - - task: DownloadSecureFile@1 - inputs: - secureFile: s3cfg - - script: ci/azure/linux_script - name: main - displayName: 'Build and test' - job: BuildWindows pool: vmImage: 'windows-2019' @@ -60,7 +49,6 @@ jobs: dependsOn: - BuildMacOS - BuildMacOS_arm64 - - BuildLinux - BuildWindows condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) strategy: @@ -68,7 +56,7 @@ jobs: pool: vmImage: 'ubuntu-18.04' variables: - version: $[ dependencies.BuildLinux.outputs['main.version'] ] + version: $[ dependencies.BuildMacOS.outputs['main.version'] ] steps: - task: DownloadSecureFile@1 inputs: diff --git a/ci/zinc/drone.yml b/ci/zinc/drone.yml index f2c84736ec..2dc48bd5ed 100644 --- a/ci/zinc/drone.yml +++ b/ci/zinc/drone.yml @@ -9,7 +9,62 @@ workspace: path: /workspace steps: -- name: build-test-package - image: ci/debian-amd64:11.1-1 +- name: probe + image: ci/debian-amd64:11.1-2 + commands: + - ./ci/zinc/linux_probe.sh + +- name: build + image: ci/debian-amd64:11.1-2 commands: - ./ci/zinc/linux_build.sh + +- name: test + depends_on: + - build + image: ci/debian-amd64:11.1-2 + commands: + - ./ci/zinc/linux_test.sh + +- name: package + depends_on: + - test + when: + branch: + - master + event: + - push + image: ci/debian-amd64:11.1-2 + environment: + AWS_ACCESS_KEY_ID: + from_secret: AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY: + from_secret: AWS_SECRET_ACCESS_KEY + commands: + - ./ci/zinc/linux_package.sh + +--- +kind: pipeline +type: docker +name: on-master-success +platform: + os: linux + arch: amd64 +workspace: + path: /workspace +depends_on: +- x86_64-linux +trigger: + branch: + - master + event: + - push + +steps: +- name: on-master-sucess + image: ci/debian-amd64:11.1-2 + environment: + SRHT_OAUTH_TOKEN: + from_secret: SRHT_OAUTH_TOKEN + commands: + - ./ci/zinc/linux_on_master_sucess.sh diff --git a/ci/zinc/linux_base.sh b/ci/zinc/linux_base.sh new file mode 100755 index 0000000000..5d33e19e67 --- /dev/null +++ b/ci/zinc/linux_base.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# https://docs.drone.io/pipeline/docker/syntax/workspace/ +# +# Drone automatically creates a temporary volume, known as your workspace, +# where it clones your repository. The workspace is the current working +# directory for each step in your pipeline. +# +# Because the workspace is a volume, filesystem changes are persisted between +# pipeline steps. In other words, individual steps can communicate and share +# state using the filesystem. +# +# Workspace volumes are ephemeral. They are created when the pipeline starts +# and destroyed after the pipeline completes. + +set -x +set -e + +ARCH="$(uname -m)" +JOBS="-j$(nproc)" + +DEPS_LOCAL="/deps/local" +WORKSPACE="$DRONE_WORKSPACE" + +DEBUG_STAGING="$WORKSPACE/_debug/staging" +RELEASE_STAGING="$WORKSPACE/_release/staging" + +export PATH=$DEPS_LOCAL/bin:$PATH diff --git a/ci/zinc/linux_build.sh b/ci/zinc/linux_build.sh index 9595b1c818..1d468bbd25 100755 --- a/ci/zinc/linux_build.sh +++ b/ci/zinc/linux_build.sh @@ -1,16 +1,10 @@ #!/bin/sh -set -x -set -e +. ./ci/zinc/linux_base.sh -WORKSPACE="$DRONE_WORKSPACE" -LOCAL="/deps/local" -ZIG="$LOCAL/bin/zig" -ARCH="$(uname -m)" +ZIG="$DEPS_LOCAL/bin/zig" TARGET="${ARCH}-linux-musl" MCPU="baseline" -JOBS="-j$(nproc)" -export PATH=/deps/local/bin:$PATH # Make the `zig version` number consistent. # This will affect the cmake command below. @@ -25,8 +19,8 @@ export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" mkdir _debug cd _debug cmake .. \ - -DCMAKE_INSTALL_PREFIX="$(pwd)/staging" \ - -DCMAKE_PREFIX_PATH="$LOCAL" \ + -DCMAKE_INSTALL_PREFIX="$DEBUG_STAGING" \ + -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ -DCMAKE_BUILD_TYPE=Debug \ -DZIG_TARGET_TRIPLE="$TARGET" \ -DZIG_TARGET_MCPU="$MCPU" \ @@ -40,7 +34,7 @@ unset CXX ninja $JOBS install -ZIG=$(pwd)/staging/bin/zig +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 @@ -52,14 +46,13 @@ cd $WORKSPACE # Build release zig. echo "BUILD release zig with zig:$($ZIG version)" -echo "zig version: $($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="$(pwd)/staging" \ - -DCMAKE_PREFIX_PATH="$LOCAL" \ + -DCMAKE_INSTALL_PREFIX="$RELEASE_STAGING" \ + -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \ -DCMAKE_BUILD_TYPE=Release \ -DZIG_TARGET_TRIPLE="$TARGET" \ -DZIG_TARGET_MCPU="$MCPU" \ @@ -75,81 +68,5 @@ cd $WORKSPACE # Formatting errors can be fixed by running `zig fmt` on the files printed here. $ZIG fmt --check . -$ZIG test test/behavior.zig -fno-stage1 -fLLVM -I test - -$ZIG build test-behavior -Denable-qemu -Denable-wasmtime -$ZIG build test-compiler-rt -Denable-qemu -Denable-wasmtime -$ZIG build test-std -Denable-qemu -Denable-wasmtime -$ZIG build test-minilibc -Denable-qemu -Denable-wasmtime -$ZIG build test-compare-output -Denable-qemu -Denable-wasmtime -$ZIG build test-standalone -Denable-qemu -Denable-wasmtime -$ZIG build test-stack-traces -Denable-qemu -Denable-wasmtime -$ZIG build test-cli -Denable-qemu -Denable-wasmtime -$ZIG build test-asm-link -Denable-qemu -Denable-wasmtime -$ZIG build test-runtime-safety -Denable-qemu -Denable-wasmtime -$ZIG build test-translate-c -Denable-qemu -Denable-wasmtime -$ZIG build test-run-translated-c -Denable-qemu -Denable-wasmtime -$ZIG build docs -Denable-qemu -Denable-wasmtime -$ZIG build # test building self-hosted without LLVM -$ZIG build test-fmt -Denable-qemu -Denable-wasmtime -$ZIG build test-stage2 -Denable-qemu -Denable-wasmtime - -# Look for HTML errors. -tidy --drop-empty-elements no -qe zig-cache/langref.html - -# The remainder of this script is for master branch only. -if [ -n "$DRONE_PULL_REQUEST" ]; then - exit 0 -fi - -STAGING=_release/staging - -# Produce the experimental std lib documentation. -mkdir -p $STAGING/docs/std -$ZIG test lib/std/std.zig \ - --zig-lib-dir lib \ - -femit-docs=$STAGING/docs/std \ - -fno-emit-bin - -cp LICENSE $STAGING/ -cp zig-cache/langref.html $STAGING/docs/ - -# Remove the unnecessary bin dir in $prefix/bin/zig -mv $STAGING/bin/zig $STAGING/ -rmdir $STAGING/bin - -# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig -mv $STAGING/lib/zig $STAGING/lib2 -rmdir $STAGING/lib -mv $STAGING/lib2 $STAGING/lib - -VERSION=$($STAGING/zig version) -BASENAME="zig-linux-$ARCH-$VERSION" -TARBALL="${BASENAME}.tar.xz" -mv "$STAGING" "$BASENAME" -tar cfJ "$TARBALL" "$BASENAME" -ls -l "$TARBALL" - -# TODO: push artifact/meta somewhere -## mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg" -## s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ -## -## SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) -## BYTESIZE=$(wc -c < $TARBALL) -## -## JSONFILE="linux-$GITBRANCH.json" -## touch $JSONFILE -## echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE -## echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE -## echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE -## -## s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE" -## s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json" -## -## # `set -x` causes these variables to be mangled. -## # See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html -## set +x -## echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" -## echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" -## echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" -## echo "##vso[task.setvariable variable=version;isOutput=true]$VERSION" +# Explicit exit helps show last command duration. +exit diff --git a/ci/zinc/linux_on_master_sucess.sh b/ci/zinc/linux_on_master_sucess.sh new file mode 100755 index 0000000000..ffd4f4c1c2 --- /dev/null +++ b/ci/zinc/linux_on_master_sucess.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. ./ci/zinc/linux_base.sh + +# Avoid leaking oauth token. +set +x + +cd $WORKSPACE +./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN" + +# Explicit exit helps show last command duration. +exit diff --git a/ci/zinc/linux_package.sh b/ci/zinc/linux_package.sh new file mode 100755 index 0000000000..9a4614c923 --- /dev/null +++ b/ci/zinc/linux_package.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +. ./ci/zinc/linux_base.sh + +cp LICENSE $RELEASE_STAGING/ +cp zig-cache/langref.html $RELEASE_STAGING/docs/ + +# Remove the unnecessary bin dir in $prefix/bin/zig +mv $RELEASE_STAGING/bin/zig $RELEASE_STAGING/ +rmdir $RELEASE_STAGING/bin + +# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig +mv $RELEASE_STAGING/lib/zig $RELEASE_STAGING/lib2 +rmdir $RELEASE_STAGING/lib +mv $RELEASE_STAGING/lib2 $RELEASE_STAGING/lib + +VERSION=$($RELEASE_STAGING/zig version) +BASENAME="zig-linux-$ARCH-$VERSION" +TARBALL="$BASENAME.tar.xz" +mv "$RELEASE_STAGING" "$BASENAME" +tar cfJ "$TARBALL" "$BASENAME" +ls -l "$TARBALL" + +SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) +BYTESIZE=$(wc -c < $TARBALL) + +MANIFEST="manifest.json" +touch $MANIFEST +echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST +echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST +echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST + +# Publish artifact. +s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ + +# Publish manifest. +s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json" + +# Explicit exit helps show last command duration. +exit diff --git a/ci/zinc/linux_probe.sh b/ci/zinc/linux_probe.sh new file mode 100755 index 0000000000..7c7d6c52fe --- /dev/null +++ b/ci/zinc/linux_probe.sh @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000000..c41f2cd919 --- /dev/null +++ b/ci/zinc/linux_test.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +. ./ci/zinc/linux_base.sh + +ZIG=$DEBUG_STAGING/bin/zig + +$ZIG test test/behavior.zig -fno-stage1 -fLLVM -I test + +$ZIG build test-behavior -Denable-qemu -Denable-wasmtime +$ZIG build test-compiler-rt -Denable-qemu -Denable-wasmtime +$ZIG build test-std -Denable-qemu -Denable-wasmtime +$ZIG build test-minilibc -Denable-qemu -Denable-wasmtime +$ZIG build test-compare-output -Denable-qemu -Denable-wasmtime +$ZIG build test-standalone -Denable-qemu -Denable-wasmtime +$ZIG build test-stack-traces -Denable-qemu -Denable-wasmtime +$ZIG build test-cli -Denable-qemu -Denable-wasmtime +$ZIG build test-asm-link -Denable-qemu -Denable-wasmtime +$ZIG build test-runtime-safety -Denable-qemu -Denable-wasmtime +$ZIG build test-translate-c -Denable-qemu -Denable-wasmtime +$ZIG build test-run-translated-c -Denable-qemu -Denable-wasmtime +$ZIG build docs -Denable-qemu -Denable-wasmtime +$ZIG build # test building self-hosted without LLVM +$ZIG build test-fmt -Denable-qemu -Denable-wasmtime +$ZIG build test-stage2 -Denable-qemu -Denable-wasmtime + +# Produce the experimental std lib documentation. +mkdir -p $RELEASE_STAGING/docs/std +$ZIG test lib/std/std.zig \ + --zig-lib-dir lib \ + -femit-docs=$RELEASE_STAGING/docs/std \ + -fno-emit-bin + +# Look for HTML errors. +tidy --drop-empty-elements no -qe zig-cache/langref.html + +# Explicit exit helps show last command duration. +exit |
