Commit a7d215759e
Changed files (9)
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
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:
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
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
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
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
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
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
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