1#!/bin/sh
2# Continuous Integration Script
3# By default, this will run a release build and checks
4# locally. When run by CI, it will upload artifacts and
5# deploy the language reference web page.
6set -e
7
8commit=$(git rev-parse HEAD)
9commit_short=$(echo "$commit" | cut -c -9)
10
11./build --version
12typos
13dprint check
14
15if [ -n "$BUILDKITE" ] || [ "$1" == "all" ]; then
16 # perform the entire build
17 ./build all --summary all
18
19 if [ -n "$BUILDKITE" ]; then
20 pushd zig-out/package
21 zip -r compiler-$commit.zip *
22 buildkite-agent artifact upload compiler-$commit.zip
23 popd
24
25 rm -fr zig-out/site
26 mkdir zig-out/site
27 cp zig-out/package/ix.html zig-out/site/index.html
28 branch="$BUILDKITE_BRANCH"
29 if [ "$branch" = "dev" ]; then
30 branch=main
31 fi
32 CLOUDFLARE_API_TOKEN="$(buildkite-agent secret get CLOUDFLARE_API_TOKEN)" \
33 CLOUDFLARE_ACCOUNT_ID="$(buildkite-agent secret get CLOUDFLARE_ACCOUNT_ID)" \
34 wrangler pages deploy zig-out/site --branch "$branch" --commit-hash "$commit" --no-bundle --project-name language-manual
35 fi
36else
37 # perform only the tests, with a shorter summary
38 ./build test --summary new
39fi