-
Notifications
You must be signed in to change notification settings - Fork 231
155 lines (130 loc) · 5.35 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest-xlarge]
build_flag: [fastbuild, opt]
openmp: ["openmp", "no-openmp"]
include:
- os: ubuntu-latest
bazel_config: linux
- os: macos-latest-xlarge
bazel_config: macos_arm64
- openmp: "openmp"
has_openmp: "--//:has_openmp"
exclude:
- build_flag: fastbuild
openmp: "openmp"
runs-on: ${{ matrix.os }}
steps:
- name: Free up space on linux
if: matrix.os == 'ubuntu-latest'
run: |
df -h
rm -rf /usr/share/dotnet/
rm -rf /opt/hostedtoolcache
df -h
- name: Free up space on macos
if: matrix.os == 'macos-latest-xlarge'
run: |
df -h
sudo rm -rf ~/Library/Caches/*
df -h
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Bazel
uses: bazel-contrib/[email protected]
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Share a single build cache between workflows.
disk-cache: ${{ matrix.os }}-${{ matrix.build_flag }}-${{ matrix.openmp }}
# Share repository cache between workflows.
repository-cache: false
# Cache external repositories
external-cache: false
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install numpy
run: python3 -m pip install numpy
- name: Install OpenMP on linux
if: matrix.os == 'ubuntu-latest' && matrix.openmp == 'openmp'
run: sudo apt-get install -y libomp-dev
- name: Install OpenMP on macos
if: matrix.os == 'macos-latest-xlarge' && matrix.openmp == 'openmp'
run: brew install libomp
- name: Add .bazelrc.user on linux
if: matrix.os == 'ubuntu-latest'
run: echo "build --config linux" > .bazelrc.user &&
echo "build --action_env=CARGO=$HOME/.cargo/bin/cargo" >> .bazelrc.user &&
echo "build --@rules_rust//rust/toolchain/channel=nightly" >> .bazelrc.user
- name: Add .bazelrc.user on macos
if: matrix.os == 'macos-latest-xlarge'
run: brew install coreutils &&
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" &&
echo "build --config macos_arm64" > .bazelrc.user &&
echo "build --action_env=CARGO=$HOME/.cargo/bin/cargo" >> .bazelrc.user &&
echo "build --@rules_rust//rust/toolchain/channel=nightly" >> .bazelrc.user
- name: Build
run: bazel build -c ${{ matrix.build_flag }} ${{ matrix.has_openmp }} //...
- name: Test
# NOTE(chokobole): Test timeouts are overridden 1.5x of the default timeout due to timeout failure on GitHub Actions.
# See https://github.com/kroma-network/tachyon/actions/runs/9581476338/job/26418352737.
run: bazel test -c ${{ matrix.build_flag }} ${{ matrix.has_openmp }} --test_output=errors --test_tag_filters -benchmark,-manual,-cuda //... --test_timeout=90,450,1350,5400
- name: Test Node Binding
run: |
cd tachyon/node/test
bazel test --config ${{ matrix.bazel_config }} -c ${{ matrix.build_flag}} --test_output=errors //...
- name: Test Py Binding
run: |
cd tachyon/py/test
bazel test --config ${{ matrix.bazel_config }} -c ${{ matrix.build_flag}} --test_output=errors //...
- name: Test Circom
run: |
cd vendors/circom
CARGO_BAZEL_REPIN=true bazel test --config ${{ matrix.bazel_config }} -c ${{ matrix.build_flag}} --test_output=errors //...
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Git
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git fetch --all
- name: Setup Python for cpplint
uses: actions/setup-python@v5
with:
python-version: "3.10.12"
- name: Install cpplint
run: pip install cpplint
- name: Run cpplint
if: github.event_name == 'pull_request'
run: git diff --name-status HEAD origin/${{ github.base_ref }} | cut -f 2,3 | xargs cpplint --filter=-legal/copyright,-whitespace/line_length,-build/namespaces,-runtime/references
- name: Run clang-format lint
uses: jidicula/[email protected]
with:
clang-format-version: "17"
check-path: "."
- name: Install Buildifier
run: |
wget https://github.com/bazelbuild/buildtools/releases/download/v6.4.0/buildifier-linux-amd64
chmod +x buildifier-linux-amd64
sudo mv buildifier-linux-amd64 /usr/local/bin/buildifier
- name: Run Buildifier
run: |
find . -iname "*.bazel" -o -iname "*.bzl" -o -name "WORKSPACE" | xargs buildifier --lint=fix
find . -iname "*.bazel" -o -iname "*.bzl" -o -name "WORKSPACE" | xargs buildifier --mode=check
git diff --exit-code