forked from facebookarchive/skybison
-
-
Notifications
You must be signed in to change notification settings - Fork 3
163 lines (144 loc) · 5.95 KB
/
cmake.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
156
157
158
159
160
161
162
163
name: CMake
on:
push:
branches: [ trunk ]
pull_request:
branches: [ trunk ]
jobs:
build:
strategy:
matrix:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: [DebugOpt, RelWithDebInfo]
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Update package repos
run: sudo apt update
- name: Install ninja
run: sudo apt install -y ninja-build
- name: Configure CMake
run: |
cmake -GNinja -B ${{github.workspace}}/build \
-DCMAKE_TOOLCHAIN_FILE=util/linux.cmake \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
- name: Build
working-directory: ${{github.workspace}}/build
run: ninja -j4
- name: Run C++ tests with Skybison
working-directory: ${{github.workspace}}/build
run: ${{github.workspace}}/third-party/gtest-parallel/gtest-parallel ./bin/python-tests
- name: Run C++ tests with Skybison (C++ interpreter)
working-directory: ${{github.workspace}}/build
run: PYRO_CPP_INTERPRETER=1 ${{github.workspace}}/third-party/gtest-parallel/gtest-parallel ./bin/python-tests
- name: Run Python tests with Skybison
working-directory: ${{github.workspace}}
run: PYRO_BUILD_DIR="build" ./util/python_tests_pyro.sh
- name: Run Python tests with Skybison (C++ interpreter)
working-directory: ${{github.workspace}}
run: PYRO_CPP_INTERPRETER=1 PYRO_BUILD_DIR="build" ./util/python_tests_pyro.sh
benchmark:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Update package repos
run: sudo apt update
- name: Install tools
run: sudo apt install -y ninja-build ccache valgrind
- name: Quickbench
working-directory: ${{github.workspace}}
run: |
mkdir -p /var/tmp/django_minimal
pushd /var/tmp/django_minimal
${{github.workspace}}/benchmarks/benchmarks/django/setup_django_minimal.sh
popd
./benchmarks/quickbench/diffrevs.py --run-django HEAD^ HEAD | tee django-benchmark-results.json
# Hide all previous benchmark comments from GitHub Actions; they are
# outdated.
- uses: int128/hide-comment-action@v1
- name: Comment on Pull Request
uses: actions/github-script@v6
with:
script: |
const { promises: fs } = require('fs');
const benchmark_results = await fs.readFile('${{github.workspace}}/django-benchmark-results.json', 'utf8');
const formatted_body = "```json\n" + benchmark_results + "\n```";
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: formatted_body,
})
- name: Run benchmarks
working-directory: ${{github.workspace}}
run: |
# Should be cached
PREV_BUILD="$(./benchmarks/quickbench/build_rev.py HEAD^)"
CURR_BUILD="$(./benchmarks/quickbench/build_rev.py HEAD)"
./benchmarks/run.py --tool callgrind --json \
--interpreter "$PREV_BUILD" --interpreter-name python_base --path $(pwd)/benchmarks/benchmarks \
--interpreter "$CURR_BUILD" --interpreter-name python_new --path $(pwd)/benchmarks/benchmarks \
--interpreter $(which python3.8) --interpreter-name fbcode-cpython --path $(pwd)/benchmarks/benchmarks \
| tee benchmark-results.json
- name: Format benchmark results
working-directory: ${{github.workspace}}
run: |
./benchmarks/format_results.py benchmark-results.json | tee benchmark-results.md
- name: Comment on Pull Request
uses: actions/github-script@v6
with:
script: |
const { promises: fs } = require('fs');
const benchmark_results = await fs.readFile('${{github.workspace}}/benchmark-results.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: benchmark_results,
})
run-cpython-tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Update package repos
run: sudo apt update
- name: Install ninja
run: sudo apt install -y ninja-build
- name: Configure CMake
run: |
cmake -GNinja -B ${{github.workspace}}/build \
-DCMAKE_TOOLCHAIN_FILE=util/linux.cmake \
-DCMAKE_BUILD_TYPE=DebugOpt \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
- name: Build
working-directory: ${{github.workspace}}/build
run: ninja -j4 cpython cpython-tests
- name: Run C++ tests with CPython
working-directory: ${{github.workspace}}
run: ./third-party/gtest-parallel/gtest-parallel ./build/bin/cpython-tests
- name: Run Python tests with CPython
working-directory: ${{github.workspace}}
run: PYRO_BUILD_DIR="build" ./util/python_tests_cpython.sh
lint:
runs-on: ubuntu-20.04
# TODO(max): Install and run Black on Python code
steps:
- name: Update package repos
run: sudo apt update
- name: Install clang-format
run: sudo apt install -y clang-format
- uses: actions/checkout@v3
- name: Run clang-format
working-directory: ${{github.workspace}}
run: |
find capi ext runtime -type f \( -name '*.c' -o -name '*.h' -o -name '*.cpp' \) \
! -wholename 'runtime/unicode-db.cpp' \
-exec clang-format --dry-run --Werror '{}' ';'