diff --git a/.github/workflows/shared.yml b/.github/workflows/shared.yml index 56cbf34fbf..f8d4aa0e46 100644 --- a/.github/workflows/shared.yml +++ b/.github/workflows/shared.yml @@ -39,14 +39,10 @@ jobs: fail-fast: false matrix: include: - # GitHub doesn't provide AArch64 Linux machines, so we self-host a - # runner with BuildJet instead. - - { target: linux-aarch64, runner: buildjet-2vcpu-ubuntu-2204-arm } + - { target: linux-aarch64, runner: ubuntu-22.04 } - { target: linux-x86_64, runner: ubuntu-22.04 } - # GitHub doesn't provide macOS machines with Apple Silicon, so we - # self-host a runner with MacStadium instead. - - { target: macos-aarch64, runner: [self-hosted, macos, ARM64] } - - { target: macos-x86_64, runner: macos-12 } + - { target: macos-aarch64, runner: ubuntu-22.04 } + - { target: macos-x86_64, runner: ubuntu-22.04 } runs-on: ${{ matrix.runner }} @@ -57,7 +53,6 @@ jobs: - uses: actions/checkout@v3 - name: Set swap space - if: ${{ matrix.target == 'linux-x86_64' || matrix.target == 'linux-aarch64'}} run: | echo "Memory and swap:" free -h @@ -83,116 +78,75 @@ jobs: swapon --show echo - - name: chown /usr/local - if: ${{ matrix.target == 'linux-x86_64' || matrix.target == 'linux-aarch64'}} - run: | - sudo chown $(whoami) /usr/local - - name: Set up build cache uses: actions/cache@v3 with: - key: ${{ matrix.target }}-cache-1 + key: 463b405f9fb795e5032da9f9646d42b267fba90a path: | - # # Cache bazel path on Linux. - ~/.cache/bazel/_bazel_$(whoami) - # # Cache bazel path on macOS. - /private/var/tmp/_bazel_$(whoami) - # Cache musl libc toolchains. - /usr/local/*-musl + ~/.cache/zig + ./.zig-cache - - name: chown /usr/local/*-musl - if: ${{ matrix.target == 'linux-x86_64' || matrix.target == 'linux-aarch64'}} + - name: Install Zig run: | - chown -R $USER /usr/local/*-musl || true - - - name: Install bazel - if: ${{ matrix.target == 'linux-aarch64' }} - run: | - version="6.2.0" - platform="linux-arm64" - base_url="https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-${platform}" - # download bazel from github releases - curl -L -O "${base_url}" - # make bazel executable - chmod +x bazel-${version}-${platform} - # verify the binary has a good checksum - curl -L -O "${base_url}.sha256" - if [[ "$(sha256sum bazel-${version}-${platform})" == "$(cat bazel-${version}-${platform}.sha256)" ]]; then - echo "Checksum matches" - else - echo "Checksum does not match" - exit 1 - fi - # download and import the public key - curl -L -O https://bazel.build/bazel-release.pub.gpg - gpg --import bazel-release.pub.gpg - # verify the binary has a good signature - curl -L -O "${base_url}.sig" - if [[ `gpg --verify bazel-${version}-${platform}.sig` -eq 0 ]]; then - echo "Good signature from bazel" - sudo mv bazel-${version}-${platform} /usr/local/bin/bazel - else - echo "Bad signature from bazel" - exit 1 - fi - - - name: Install toolchains + version="0.14.0-dev.1637+8c232922b" + url="https://ziglang.org/builds/zig-${{ matrix.target }}-${version}.tar.xz" + # download zig + curl -L -o zig.tar.xz "${url}" + # unpack to ./zig + mkdir zig + tar -xf zig.tar.xz -C zig --strip-components=1 + # add zig to path + echo $(pwd)/zig >> $GITHUB_PATH + echo $GITHUB_PATH + + - name: Build binaries run: | case "${{ matrix.target }}" in "linux-aarch64") - sudo apt-get -y install autoconf-archive - bazel run //bazel/toolchain:aarch64-linux-musl-gcc + zig build \ + -Dtarget=aarch64-linux-musl \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} ;; "linux-x86_64") - sudo apt-get -y install autoconf-archive - bazel run //bazel/toolchain:x86_64-linux-musl-gcc + zig build \ + -Dtarget=x86_64-linux-musl \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} ;; "macos-aarch64") - brew install pkg-config autoconf-archive + zig build \ + -Dtarget=aarch64-macos \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} ;; "macos-x86_64") - # Switch Xcode path to match the path specified in our bazel toolchain. - sudo xcode-select --switch /Library/Developer/CommandLineTools - brew install automake autoconf-archive libtool llvm@15 - ;; - *) - echo "Unsupported target: ${{ matrix.target }}" - exit 1 + zig build \ + -Dtarget=x86_64-macos \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} ;; esac - - - - name: Build binary - run: | - echo "${{ inputs.pace }}" > ./PACE - case "${{ matrix.target }}" in - "linux-aarch64") - bazel build :urbit - ;; - "linux-x86_64") - bazel build :urbit - ;; - "macos-aarch64") - bazel build :urbit - ;; - "macos-x86_64") - bazel build --clang_version=15.0.7 --extra_toolchains=//bazel/toolchain:brew-clang-macos-x86_64-toolchain :urbit - ;; - esac - - name: Run unit tests + if: ${{ matrix.target == 'linux-x86_64' }} run: | - if [[ "${{ matrix.target }}" == "macos-x86_64" ]]; then - bazel test --build_tests_only --clang_version=15.0.7 --extra_toolchains=//bazel/toolchain:brew-clang-macos-x86_64-toolchain ... - else - bazel test --build_tests_only ... - fi - - - name: Run fake ship tests - if: ${{ matrix.target == 'linux-x86_64' && inputs.fake_tests }} - run: | - # See https://github.com/urbit/vere/issues/40. - bazel build //pkg/vere:test-fake-ship + zig build \ + ur-test ent-test \ + hashtable-test jets-test \ + nock-test retrieve-test \ + serial-test ames-test \ + boot-test newt-test \ + vere-noun-test unix-test \ + benchmarks \ + -Doptimize=ReleaseFast \ + -Dpace=${{inputs.pace}} \ + --summary all + + # - name: Run fake ship tests + # if: ${{ matrix.target == 'linux-x86_64' && inputs.fake_tests }} + # run: | + # # See https://github.com/urbit/vere/issues/40. + # bazel build //pkg/vere:test-fake-ship #