Skip to content

Commit

Permalink
replace buildkite with github actions
Browse files Browse the repository at this point in the history
Thus we gain Windows and MacOS hosts.
  • Loading branch information
Motiejus Jakštys committed Feb 13, 2024
1 parent 2889b7b commit 0cd9acc
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 62 deletions.
28 changes: 0 additions & 28 deletions .buildkite/pipeline.yml

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: ci
on:
push:
pull_request:
defaults:
run:
shell: bash
concurrency:
# Cancels pending runs when a PR gets updated.
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }}
cancel-in-progress: true
jobs:

build-and-test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/cache@v4
name: cache bazelisk and zig-cache directories
with:
key: cache-${{ runner.os }}-${{ hashFiles('.bazelversion', 'toolchain/private/zig_sdk.bzl', '.github/workflows/ci.yaml') }}
path: |
${{ runner.os == 'Windows' && 'C:\Temp\hermetic_cc_toolchain' || '/tmp/zig-cache' }}
${{ runner.os == 'Windows' && '~\AppData\Local\bazelisk' || '~/.cache/bazelisk' }}
- run: brew install bash
if: runner.os == 'macOS'

# Linux, macOS and Windows
- run: ci/list_toolchains_platforms
- run: ci/zig-utils

# Linux and macOS
- run: ci/release
if: runner.os == 'Linux' || runner.os == 'macOS'
- run: ci/lint
if: runner.os == 'Linux' || runner.os == 'macOS'
# TODO: releaser is broken on windows
- run: ci/prepare_git && ci/test_example rules_cc override_repository
if: runner.os == 'Linux' || runner.os == 'macOS'

# Linux and Windows
- run: tools/bazel build --config=darwin_toolchains //...
if: runner.os == 'Linux' || runner.os == 'Windows'

# Linux
- run: ci/test --config=darwin_toolchains
if: runner.os == 'Linux'
# TODO windows: broken releaser. MacOS: cgo.
- run: ci/prepare_git && ci/test_example bzlmod override_module
if: runner.os == 'Linux'

# macOS
- run: tools/bazel build --config=darwin_toolchains --build_tag_filters=darwin_c //...
if: runner.os == 'macOS'
35 changes: 1 addition & 34 deletions ci/zig-utils
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
#!/usr/bin/env bash

# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License

set -xeuo pipefail

echo "--- which zig"
ZIG=${ZIG:-$(tools/bazel run "$@" --run_under=echo @zig_sdk//:zig)}

for zigfile in $(git ls-files '*.zig'); do
echo "--- compile $zigfile for various architectures"
for target in \
aarch64-linux-gnu.2.28 \
aarch64-macos-none \
x86_64-linux-gnu.2.28 \
x86_64-macos-none \
x86_64-windows-gnu
do
if [[ $target == aarch64-macos-none ]]; then
mcpu=apple_a14
else
mcpu=baseline
fi
$ZIG build-exe -fno-emit-bin -target $target -mcpu=$mcpu "$zigfile"
done


# until hermetic_cc_toolchain gets a zig toolchain, run zig programs' unit tests here.
echo "--- zig test $zigfile"
$ZIG test "$zigfile"

# as of 2023-10 yours truly (@motiejus) was not able to install wine64
# on CI. See the commit message for details.
if [[ -z "${HERMETIC_CC_TOOLCHAIN_SKIP_WINE:-}" ]]; then
echo "--- test $zigfile via wine64"
$ZIG test \
-target x86_64-windows-gnu \
--test-cmd wine64-stable \
--test-cmd-bin \
"$zigfile"
fi
$ZIG test "$zigfile"
done
5 changes: 5 additions & 0 deletions test/gorace/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ go_library(
# keep
cgo = True,
importpath = "github.com/uber/hermetic_cc_toolchain/test/gorace",
# TODO lld-link: error: undefined symbol: WaitOnAddress on Windows
target_compatible_with = [
"@platforms//os:linux",
"@platforms//os:macos",
],
visibility = ["//visibility:private"],
)

Expand Down

0 comments on commit 0cd9acc

Please sign in to comment.