forked from facebook/CacheLib
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (143 loc) · 5.87 KB
/
build-cachelib.yml
File metadata and controls
147 lines (143 loc) · 5.87 KB
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
# NOTES:
# 1. While Github-Actions enables cache of dependencies,
# Facebook's projects (folly,fizz,wangle,fbthrift)
# are fast-moving targets - so we always checkout the latest version
# (as opposed to using gitactions cache, which is recommended in the
# documentation).
#
# 2. Using docker containers to build on CentOS and Debian,
# Specifically CentOS v8.1.1911 as that
# version is closest to Facebook's internal dev machines.
#
# 3. When using docker containers we install 'sudo',
# as the docker images are typically very minimal and without
# 'sudo', while the ./contrib/ scripts use sudo.
#
# 4. When using the docker containers we install 'git'
# BEFORE getting the CacheLib source code (with the 'checkout' action).
# Otherwise, the 'checkout@v2' action script falls back to downloading
# the git repository files only, without the ".git" directory.
# We need the ".git" directory to updating the git-submodules
# (folly/wangle/fizz/fbthrift). See:
# https://github.com/actions/checkout/issues/126#issuecomment-570288731
#
# 5. To reduce less-critical (and yet frequent) rebuilds, the jobs
# check the author of the commit, and SKIP the build if
# the author is "svcscm". These commits are automatic updates
# for the folly/fbthrift git-submodules, and can happen several times a day.
# While there is a possiblity that updating the git-submodules breaks
# CacheLib, it is less likely, and will be detected once an actual
# code change commit triggers a full build.
# e.g. https://github.com/facebookincubator/CacheLib/commit/9372a82190dd71a6e2bcb668828cfed9d1bd25c1
#
# 6. The 'if' condition checking the author name of the commit (see #5 above)
# uses github actions metadata variable:
# 'github.event.head_commit.author.name'
# GitHub have changed in the past the metadata structure and broke
# such conditions. If you need to debug the metadata values,
# see the "dummy-show-github-event" job below.
# E.g. https://github.blog/changelog/2019-10-16-changes-in-github-actions-push-event-payload/
# As of Jan-2021, the output is:
# {
# "author": {
# "email": "mimi@moo.moo",
# "name": "mimi"
# },
# "committer": {
# "email": "assafgordon@gmail.com",
# "name": "Assaf Gordon",
# "username": "agordon"
# },
# "distinct": true,
# "id": "6c3aab0970f4a07cc2af7658756a6ef9d82f3276",
# "message": "gitactions: test",
# "timestamp": "2021-01-26T11:11:57-07:00",
# "tree_id": "741cd1cb802df84362a51e5d01f28788845d08b7",
# "url": "https://github.com/agordon/CacheLib/commit/6c3aab0970f4a07cc2af7658756a6ef9d82f3276"
# }
#
# 7. When checking the commit's author name, we use '...author.name',
# NOT '...author.username' - because the 'svcscm' author does not
# have a github username (see the 'mimi' example above).
#
name: build-cachelib
on: [push]
jobs:
dummy-show-github-event:
name: "Show GitHub Action event.head_commit variable"
runs-on: ubuntu-latest
steps:
- name: "GitHub Variable Content"
env:
CONTENT: ${{ toJSON(github.event.head_commit) }}
run: echo "$CONTENT"
build-cachelib-centos8-1-1911:
if: "!contains(github.event.head_commit.author.name, 'svcscm')"
name: "CentOS/8.1.1911 - Build CacheLib with all dependencies"
runs-on: ubuntu-latest
# Docker container image name
container: "centos:8.1.1911"
steps:
- name: "update packages"
# stock centos has a problem with CMAKE, fails with:
# "cmake: symbol lookup error: cmake: undefined symbol: archive_write_add_filter_zstd"
# updating solves it
run: dnf update -y
- name: "install sudo,git"
run: dnf install -y sudo git cmake gcc
- name: "System Information"
run: |
echo === uname ===
uname -a
echo === /etc/os-release ===
cat /etc/os-release
echo === df -hl ===
df -hl
echo === free -h ===
free -h
echo === top ===
top -b -n1 -1 -Eg || timeout 1 top -b -n1
echo === env ===
env
echo === gcc -v ===
gcc -v
- name: "checkout sources"
uses: actions/checkout@v2
- name: "Install Prerequisites"
run: ./contrib/build.sh -S -B
- name: "Test: update-submodules"
run: ./contrib/update-submodules.sh
- name: "Install dependency: zstd"
run: ./contrib/build-package.sh -j -v -i zstd
- name: "Install dependency: googleflags"
run: ./contrib/build-package.sh -j -v -i googleflags
- name: "Install dependency: googlelog"
run: ./contrib/build-package.sh -j -v -i googlelog
- name: "Install dependency: googletest"
run: ./contrib/build-package.sh -j -v -i googletest
- name: "Install dependency: sparsemap"
run: ./contrib/build-package.sh -j -v -i sparsemap
- name: "Install dependency: fmt"
run: ./contrib/build-package.sh -j -v -i fmt
- name: "Install dependency: folly"
run: ./contrib/build-package.sh -j -v -i folly
- name: "Install dependency: fizz"
run: ./contrib/build-package.sh -j -v -i fizz
- name: "Install dependency: wangle"
run: ./contrib/build-package.sh -j -v -i wangle
- name: "Install dependency: fbthrift"
run: ./contrib/build-package.sh -j -v -i fbthrift
- name: "build CacheLib"
# Build cachelib in debug mode (-d) and with all tests (-t)
run: ./contrib/build-package.sh -j -v -i -d -t cachelib
- uses: actions/upload-artifact@v2
if: failure()
with:
name: cachelib-cmake-logs
path: |
build-cachelib/CMakeFiles/*.log
build-cachelib/CMakeCache.txt
build-cachelib/Makefile
build-cachelib/**/Makefile
if-no-files-found: warn
retention-days: 1