-
Notifications
You must be signed in to change notification settings - Fork 123
159 lines (157 loc) · 6.55 KB
/
presubmit.yaml
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
156
157
158
159
name: Presubmit
on:
pull_request:
push:
branches-ignore:
- main # push events to main branch occur after PRs are merged, when the same checks were run
jobs:
staticcheck:
runs-on: ubuntu-latest
strategy:
matrix:
dir: ["e2etests", "frontend/src/host_orchestrator", "frontend/src/libhoclient", "frontend/src/liboperator", "frontend/src/operator"]
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Install dependencies
uses: actions/setup-go@v3
with:
go-version: '1.23.1'
- run: go version
- name: Staticcheck
uses: dominikh/[email protected]
with:
version: "latest"
install-go: false
working-directory: ${{ matrix.dir }}
build-orchestrator:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Install dependencies
uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- run: go version
- name: Vet Test Build
run: cd frontend/src/host_orchestrator && go vet ./... && go test ./... && go build ./...
build-debian-package:
runs-on: ubuntu-20.04
if: ${{ always() && needs.build-orchestrator.result == 'success' }}
needs: [build-orchestrator]
container:
# debian:bullseye
image: debian@sha256:3b6053ca925336c804e2d3f080af177efcdc9f51198a627569bfc7c7e730ef7e
steps:
- name: Common bazel setup
uses: bazel-contrib/setup-bazel@f3f50ea6791b9b0f4c4eeabba4507422426462f5 #aka 0.9.1
with:
bazelisk-cache: true # Avoid downloading Bazel every time.
disk-cache: ${{ github.workflow }} # Store build cache per workflow.
repository-cache: true # Share repository cache between workflows.
- name: Check for dockerenv file
run: (ls /.dockerenv && echo 'Found dockerenv') || (echo 'No dockerenv')
- name: setup apt
run: apt update -y && apt upgrade -y
- name: install debuild dependencies
run: apt install -y git devscripts config-package-dev debhelper-compat golang protobuf-compiler
- name: go version
run: go version
- name: checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
with:
path: "android-cuttlefish"
- name: Install bazel
run: bash android-cuttlefish/tools/buildutils/installbazel.sh
- name: install package build dependencies
run: cd android-cuttlefish/base && mk-build-deps -i -t 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
- name: build base debian package
run: cd android-cuttlefish/base && debuild -i -us -uc -b
- name: install base debian package
run: dpkg -i android-cuttlefish/cuttlefish-base_*_*64.deb || apt-get install -f -y
- name: build frontend debian packages
run: cd android-cuttlefish/frontend && debuild -i -us -uc -b
- name: install user debian package
run: dpkg -i android-cuttlefish/cuttlefish-user_*_*64.deb || apt-get install -f -y
build-cvd:
runs-on: ubuntu-latest
container:
image: debian@sha256:3b6053ca925336c804e2d3f080af177efcdc9f51198a627569bfc7c7e730ef7e
steps:
- name: Common bazel setup
uses: bazel-contrib/setup-bazel@f3f50ea6791b9b0f4c4eeabba4507422426462f5 #aka 0.9.1
with:
bazelisk-cache: true # Avoid downloading Bazel every time.
disk-cache: ${{ github.workflow }} # Store build cache per workflow.
repository-cache: true # Share repository cache between workflows.
- name: Checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Setup apt
run: apt update -y && apt upgrade -y
- name: Install dependencies
run: apt install -y git clang libcurl4-openssl-dev clang-tidy libtinfo5
- name: Install bazel
run: bash tools/buildutils/installbazel.sh
- name: Build cvd
run: cd base/cvd && bazel build ...
- name: Test cvd
run: cd base/cvd && bazel test --sandbox_writable_path=$HOME --test_output=errors ...
- name: Upload test logs
uses: actions/upload-artifact@v4
with:
name: testlogs
path: bazel-testlogs
- name: Run clang-tidy
run: cd base/cvd && bazel build //cuttlefish/... --config clang-tidy
e2e-tests-orchestration:
runs-on: ubuntu-22.04
steps:
# Do not reuse bazel cache among `e2e-tests-orchestration` runs.
#
# Current docker image bazel target: "@images//:orchestration_image_dev_tar" is based
# on an umbrella bash script and does not depend on smaller bazel targets, hence changes
# in cvd or host orchestrator code won't trigger building a new image.
- name: Free space
run: |
echo "disk space before cleanup:"
df -h
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/hostedtoolcache
sudo rm -rf /opt/ghc
sudo apt-get clean
echo "disk space after cleanup:"
df -h
- name: Check kvm
run: |
ls /dev/kvm
- name: checkout repository
uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 # aka v2
- name: Install bazel
run: sudo bash tools/buildutils/installbazel.sh
- name: bazel version
run: bazel version
- name: Run orchestration e2e tests
run: |
cd e2etests
# Run orchestration e2e tests serially due lack of space in Github standard runners.
#
# Overall action timing breakdown:
#
# [614 / 616] Executing genrule @@images//docker/debs-builder-docker:debs_tar [for tool]; 608s linux-sandbox
# [615 / 616] Executing genrule @@images//docker:orchestration_image_dev_tar; 11s linux-sandbox
# //orchestration:create_fixed_build_id_and_target PASSED in 99.9s
# //orchestration:create_local_image PASSED in 92.4s
#
# The tests are running under 2 min, it's ok for now to execute them serially. The action's
# bottleneck is building the debian packages: `@@images//docker/debs-builder-docker:debs_tar`.
bazel test --sandbox_writable_path=$HOME --test_output=errors --local_test_jobs=1 --test_timeout=480 orchestration/...
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: testlogs
path: e2etests/bazel-testlogs