Skip to content

Commit ba6dece

Browse files
committed
ci: Add github build
Signed-off-by: Ryan Northey <ryan@synca.io>
1 parent 75ebbf0 commit ba6dece

File tree

7 files changed

+69
-6
lines changed

7 files changed

+69
-6
lines changed

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ common:debs-ci --config=ci
1919
common:debs-ci --//debs:excludes=//debs:excludes.txt
2020
common:debs-ci --//debs:token=//debs:token.txt
2121

22+
common:debs-publish --//debs:debs-publish=//debs:import
23+
2224
common:publish-ci --config=debs-ci
2325
common:publish-ci --//tools/tarball:target=//:html
2426
common:publish-ci --//tools/tarball:overwrite=//tools/tarball:true

.github/workflows/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
12+
concurrency:
13+
group: >-
14+
${{ github.event.inputs.head_ref || github.run_id }}
15+
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest-8-cores
20+
if: ${{ github.repository_owner == 'envoyproxy' }}
21+
steps:
22+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
23+
24+
- run: |
25+
mkdir ./debs/import
26+
gsutil -mq rsync -r gs://envoy-apt-cache/debs ./debs/import/
27+
ls -alh debs/import/
28+
29+
- run: |
30+
sudo mkdir /opt/build
31+
sudo chown runner:docker /opt/build
32+
echo ${{ github.token }} > debs/token.txt
33+
./build-repository.sh
34+
du -ch /opt/build
35+
du -ch ~/.cache
36+
env:
37+
CONTEXT: deploy-preview
38+
GITHUB_TOKEN: ${{ github.token }}

build-repository.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ UNDERLINE="\e[4m"
77
NORMAL="\e[0m"
88

99
EXCLUDE_FILE=debs/excludes.txt
10-
DEBS_ROOT=/opt/build/cache/repository
10+
DEBS_ROOT="${DEBS_ROOT:-/opt/build/cache/repository}"
11+
OUTPUT_DIR="${OUTPUT_DIR:-/opt/build/repo/html}"
1112
SIGNING_KEY_PASSPHRASE="${SIGNING_KEY_PASSPHRASE:-Hackme}"
1213

1314

@@ -103,8 +104,12 @@ main () {
103104
fi
104105
bazel run \
105106
"${bazel_args[@]}" \
107+
--config=debug-bazel \
108+
--config=debs-publish \
109+
--sandbox_writable_path=/opt/build \
110+
--sandbox_writable_path=/home/runner/.gnupg/ \
106111
//tools/tarball:unpack \
107-
/opt/build/repo/html
112+
$OUTPUT_DIR
108113
}
109114

110115
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then

debs/BUILD

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,26 @@ fetch_debs(
139139
excludes = ":excludes",
140140
)
141141

142+
filegroup(
143+
name = "import",
144+
srcs = glob(["import/v*/*"]),
145+
)
146+
142147
PUBLISH_ENV = {
143148
"APTLY_BIN": "$(location @aptly)",
144149
"MAINTAINER_KEY": "$(location //:envoy-maintainers-public.key)",
145150
"APTLY_CONF": "$(location //:aptly-config)",
146-
"DEBS": "$(location :debs)",
151+
"DEBS": "$(locations :debs-publish)",
147152
"DEBS_ROOT": "$${APT_ROOT}/repository",
148153
"SIGNING_TOKEN": "$(location :signing-token)",
149154
}
150155

156+
label_flag(
157+
name = "debs-publish",
158+
build_setting_default = ":debs",
159+
visibility = ["//visibility:public"],
160+
)
161+
151162
sh_binary(
152163
name = "publish",
153164
srcs = ["publish.sh"],
@@ -159,7 +170,7 @@ sh_binary(
159170
"@aptly",
160171
"//:aptly-config",
161172
"//:envoy-maintainers-public.key",
162-
":debs",
173+
":debs-publish",
163174
":signing-token",
164175
],
165176
visibility = ["//visibility:public"],
@@ -169,9 +180,10 @@ HTML_BUILD_CMD = """
169180
export APTLY_BIN="$(location @aptly)"
170181
export MAINTAINER_KEY="$(location //:envoy-maintainers-public.key)"
171182
export APTLY_CONF="$(location //:aptly-config)"
172-
export DEBS="$(location :debs)"
183+
export DEBS="$(locations :debs-publish)"
173184
export DEBS_ROOT="$${APT_ROOT}/repository"
174185
export SIGNING_TOKEN="$(location :signing-token)"
186+
ls -alh /opt/build
175187
$(location :publish)
176188
tar hcf $@ -C $${APT_ROOT}/html .
177189
"""
@@ -187,7 +199,7 @@ genrule(
187199
"@aptly",
188200
"//:aptly-config",
189201
"//:envoy-maintainers-public.key",
190-
":debs",
202+
":debs-publish",
191203
":publish",
192204
":signing-token",
193205
],

debs/publish.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ if [[ -z "$SIGNING_KEY" ]]; then
1717
exit 1
1818
fi
1919

20+
if [[ -n "$DEBS" ]]; then
21+
DEBS="$(dirname $(dirname $(echo ${DEBS} | cut -d' ' -f1)))"
22+
fi
2023

2124
_aptly () {
2225
"${APTLY[@]}" -- "${@}"
@@ -41,6 +44,7 @@ create_dirs () {
4144

4245
unpack_debs () {
4346
if [[ -d "$DEBS" ]]; then
47+
DEBS_ROOT=$DEBS
4448
return 0
4549
elif [[ -s "$DEBS" ]]; then
4650
tar xf "$DEBS" -C "$DEBS_ROOT"

netlify-should-run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exit 1

netlify.toml

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[build]
22
publish = "html"
33
command = "./build-repository.sh"
4+
ignore = "./netlify-should-run.sh"
45

56
[build.environment]
67
BAZELISK_HOME="/opt/build/cache/bazelisk"

0 commit comments

Comments
 (0)