Skip to content

Commit 5bbfdc1

Browse files
authored
Switch Travis CI to GitHub Actions (cmu-db#161)
1 parent c841631 commit 5bbfdc1

22 files changed

+305
-271
lines changed

.clang-tidy

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,17 @@ Checks: '
4343
-readability-qualified-auto,
4444
-readability-redundant-access-specifiers,
4545
'
46-
# TODO(WAN): To be enabled in Fall 2020.
47-
#CheckOptions:
48-
# - { key: readability-identifier-naming.ClassCase, value: CamelCase }
49-
# - { key: readability-identifier-naming.EnumCase, value: CamelCase }
50-
# - { key: readability-identifier-naming.FunctionCase, value: CamelCase }
51-
# - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
52-
# - { key: readability-identifier-naming.MemberCase, value: lower_case }
53-
# - { key: readability-identifier-naming.MemberSuffix, value: _ }
54-
# - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
55-
# - { key: readability-identifier-naming.StructCase, value: CamelCase }
56-
# - { key: readability-identifier-naming.UnionCase, value: CamelCase }
57-
# - { key: readability-identifier-naming.VariableCase, value: lower_case }
46+
CheckOptions:
47+
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
48+
- { key: readability-identifier-naming.EnumCase, value: CamelCase }
49+
- { key: readability-identifier-naming.FunctionCase, value: CamelCase }
50+
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
51+
- { key: readability-identifier-naming.MemberCase, value: lower_case }
52+
- { key: readability-identifier-naming.MemberSuffix, value: _ }
53+
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
54+
- { key: readability-identifier-naming.StructCase, value: CamelCase }
55+
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
56+
- { key: readability-identifier-naming.VariableCase, value: lower_case }
5857
WarningsAsErrors: '*'
5958
HeaderFilterRegex: '/(src|test)/include'
6059
AnalyzeTemporaryDtors: true

.github/workflows/cmake.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CMake Build Matrix
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
BUILD_TYPE: Debug
11+
12+
jobs:
13+
build:
14+
name: ${{ matrix.config.name }}
15+
runs-on: ${{ matrix.config.os }}
16+
17+
strategy:
18+
fail-fast: true
19+
matrix:
20+
config:
21+
- {
22+
name: "Ubuntu Latest GCC",
23+
os: ubuntu-latest,
24+
cc: "/usr/bin/gcc",
25+
cxx: "/usr/bin/g++",
26+
format: "/usr/bin/clang-format-8",
27+
tidy: "/usr/bin/clang-tidy-8"
28+
}
29+
- {
30+
name: "Ubuntu Latest Clang",
31+
os: ubuntu-latest,
32+
cc: "/usr/bin/clang-8",
33+
cxx: "/usr/bin/clang++8",
34+
format: "/usr/bin/clang-format-8",
35+
tidy: "/usr/bin/clang-tidy-8"
36+
}
37+
- {
38+
name: "macOS Latest Clang",
39+
os: macos-latest,
40+
cc: "/usr/bin/clang",
41+
cxx: "/usr/bin/clang++",
42+
format: "/usr/local/opt/llvm@8/bin/clang-format",
43+
tidy: "/usr/local/opt/llvm@8/bin/clang-tidy"
44+
}
45+
46+
steps:
47+
- uses: actions/checkout@v2
48+
49+
- name: Print env
50+
run: |
51+
echo github.event.action: ${{ github.event.action }}
52+
echo github.event_name: ${{ github.event_name }}
53+
- name: Install Dependencies (Ubuntu)
54+
if: runner.os == 'Linux'
55+
working-directory: ${{github.workspace}}
56+
run: sudo bash ./build_support/packages.sh -y
57+
58+
- name: Install Dependencies (OSX)
59+
if: runner.os == 'macOS'
60+
working-directory: ${{github.workspace}}
61+
run: bash ./build_support/packages.sh -y
62+
63+
- name: Configure CMake
64+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCC=${{matrix.config.cc}} -DCXX=${{matrix.config.cxx}} -DCLANG_FORMAT_BIN=${{matrix.config.format}} -DCLANG_TIDY_BIN=${{matrix.config.tidy}}
65+
66+
- name: Build
67+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
68+
69+
- name: Check Format
70+
working-directory: ${{github.workspace}}/build
71+
run: make check-format
72+
73+
- name: Check Lint
74+
working-directory: ${{github.workspace}}/build
75+
run: make check-lint
76+
77+
- name: Check Clang Tidy
78+
working-directory: ${{github.workspace}}/build
79+
run: make check-clang-tidy
80+
81+
- name: Check Tests (Ubuntu)
82+
if: runner.os == 'Linux'
83+
working-directory: ${{github.workspace}}/build
84+
run: make check-tests
85+
86+
- name: Check Tests (OSX)
87+
if: runner.os == 'macOS'
88+
working-directory: ${{github.workspace}}/build
89+
# Disable container overflow checks on OSX
90+
run: ASAN_OPTIONS=detect_container_overflow=0 make check-tests

.travis.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,25 @@ set(BUSTUB_CLANG_SEARCH_PATH "/usr/local/bin" "/usr/bin" "/usr/local/opt/llvm/bi
3232
enable_testing()
3333

3434
# clang-format
35-
find_program(CLANG_FORMAT_BIN
36-
NAMES clang-format clang-format-8
37-
HINTS ${BUSTUB_CLANG_SEARCH_PATH})
35+
if (NOT DEFINED CLANG_FORMAT_BIN)
36+
# attempt to find the binary if user did not specify
37+
find_program(CLANG_FORMAT_BIN
38+
NAMES clang-format clang-format-8
39+
HINTS ${BUSTUB_CLANG_SEARCH_PATH})
40+
endif()
3841
if ("${CLANG_FORMAT_BIN}" STREQUAL "CLANG_FORMAT_BIN-NOTFOUND")
3942
message(WARNING "BusTub/main couldn't find clang-format.")
4043
else()
4144
message(STATUS "BusTub/main found clang-format at ${CLANG_FORMAT_BIN}")
4245
endif()
4346

4447
# clang-tidy
45-
find_program(CLANG_TIDY_BIN
46-
NAMES clang-tidy clang-tidy-8
47-
HINTS ${BUSTUB_CLANG_SEARCH_PATH})
48+
if (NOT DEFINED CLANG_TIDY_BIN)
49+
# attempt to find the binary if user did not specify
50+
find_program(CLANG_TIDY_BIN
51+
NAMES clang-tidy clang-tidy-8
52+
HINTS ${BUSTUB_CLANG_SEARCH_PATH})
53+
endif()
4854
if ("${CLANG_TIDY_BIN}" STREQUAL "CLANG_TIDY_BIN-NOTFOUND")
4955
message(WARNING "BusTub/main couldn't find clang-tidy.")
5056
else()

src/include/common/util/hash_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using hash_t = std::size_t;
2626

2727
class HashUtil {
2828
private:
29-
static const hash_t prime_factor = 10000019;
29+
static const hash_t PRIME_FACTOR = 10000019;
3030

3131
public:
3232
static inline hash_t HashBytes(const char *bytes, size_t length) {
@@ -45,7 +45,7 @@ class HashUtil {
4545
return HashBytes(reinterpret_cast<char *>(both), sizeof(hash_t) * 2);
4646
}
4747

48-
static inline hash_t SumHashes(hash_t l, hash_t r) { return (l % prime_factor + r % prime_factor) % prime_factor; }
48+
static inline hash_t SumHashes(hash_t l, hash_t r) { return (l % PRIME_FACTOR + r % PRIME_FACTOR) % PRIME_FACTOR; }
4949

5050
template <typename T>
5151
static inline hash_t Hash(const T *ptr) {

src/include/execution/executors/aggregation_executor.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ class SimpleAggregationHashTable {
9797
* @param agg_val the value to be inserted
9898
*/
9999
void InsertCombine(const AggregateKey &agg_key, const AggregateValue &agg_val) {
100-
if (ht.count(agg_key) == 0) {
101-
ht.insert({agg_key, GenerateInitialAggregateValue()});
100+
if (ht_.count(agg_key) == 0) {
101+
ht_.insert({agg_key, GenerateInitialAggregateValue()});
102102
}
103-
CombineAggregateValues(&ht[agg_key], agg_val);
103+
CombineAggregateValues(&ht_[agg_key], agg_val);
104104
}
105105

106106
/**
@@ -135,14 +135,14 @@ class SimpleAggregationHashTable {
135135
};
136136

137137
/** @return iterator to the start of the hash table */
138-
Iterator Begin() { return Iterator{ht.cbegin()}; }
138+
Iterator Begin() { return Iterator{ht_.cbegin()}; }
139139

140140
/** @return iterator to the end of the hash table */
141-
Iterator End() { return Iterator{ht.cend()}; }
141+
Iterator End() { return Iterator{ht_.cend()}; }
142142

143143
private:
144144
/** The hash table is just a map from aggregate keys to aggregate values. */
145-
std::unordered_map<AggregateKey, AggregateValue> ht{};
145+
std::unordered_map<AggregateKey, AggregateValue> ht_{};
146146
/** The aggregate expressions that we have. */
147147
const std::vector<const AbstractExpression *> &agg_exprs_;
148148
/** The types of aggregations that we have. */

src/include/primer/p0_starter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Matrix {
2929
protected:
3030
/**
3131
* TODO(P0): Add implementation
32-
*
32+
*
3333
* Construct a new Matrix instance.
3434
* @param rows The number of rows
3535
* @param cols The number of columns

src/include/storage/index/b_plus_tree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ class BPlusTree {
5555
bool GetValue(const KeyType &key, std::vector<ValueType> *result, Transaction *transaction = nullptr);
5656

5757
// index iterator
58-
INDEXITERATOR_TYPE begin();
58+
INDEXITERATOR_TYPE Begin();
5959
INDEXITERATOR_TYPE Begin(const KeyType &key);
60-
INDEXITERATOR_TYPE end();
60+
INDEXITERATOR_TYPE End();
6161

6262
void Print(BufferPoolManager *bpm) {
6363
ToString(reinterpret_cast<BPlusTreePage *>(bpm->FetchPage(root_page_id_)->GetData()), bpm);

src/include/storage/index/index_iterator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class IndexIterator {
2626
IndexIterator();
2727
~IndexIterator();
2828

29-
bool isEnd();
29+
bool IsEnd();
3030

3131
const MappingType &operator*();
3232

src/include/storage/page/b_plus_tree_internal_page.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ class BPlusTreeInternalPage : public BPlusTreePage {
6161
void CopyNFrom(MappingType *items, int size, BufferPoolManager *buffer_pool_manager);
6262
void CopyLastFrom(const MappingType &pair, BufferPoolManager *buffer_pool_manager);
6363
void CopyFirstFrom(const MappingType &pair, BufferPoolManager *buffer_pool_manager);
64-
MappingType array[0];
64+
MappingType array_[0];
6565
};
6666
} // namespace bustub

0 commit comments

Comments
 (0)