Skip to content

Add some static analysis in bytecode rewriting #348

Add some static analysis in bytecode rewriting

Add some static analysis in bytecode rewriting #348

Workflow file for this run

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: 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: 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: 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: 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 '{}' ';'