Skip to content

Commit

Permalink
Merge branch 'main' into fix-soundness
Browse files Browse the repository at this point in the history
  • Loading branch information
zxch3n committed Aug 25, 2023
2 parents 7605762 + 39aaace commit 904395d
Show file tree
Hide file tree
Showing 121 changed files with 4,579 additions and 378 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }

[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "target-cpu=native"]
9 changes: 7 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
root = true

[*.yml]
indent_size = 2
[*.rs]
max_line_length = 120
indent_size = 4
[*.toml]
indent_size = 2
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 4
indent_style = space
max_line_length = 120
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4, available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

For answers to common questions about this code of conduct, see <https://www.contributor-covenant.org/faq>
For answers to common questions about this code of conduct, see <https://www.contributor-covenant.org/faq>
44 changes: 44 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Y-Octo Node.js Setup"
description: "Node.js setup for CI, including cache configuration"
inputs:
extra-flags:
description: "Extra flags to pass to the yarn install."
required: false
default: "--immutable --inline-builds"
package-install:
description: "Run the install step."
required: false
default: "true"
hard-link-nm:
description: "set nmMode to hardlinks-local in .yarnrc.yml"
required: false
default: "true"

runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "yarn"

- name: Set nmMode
if: ${{ inputs.hard-link-nm == 'true' }}
shell: bash
run: yarn config set nmMode hardlinks-local

- name: yarn install
if: ${{ inputs.package-install == 'true' }}
continue-on-error: true
shell: bash
run: yarn install ${{ inputs.extra-flags }}
env:
HUSKY: "0"

- name: yarn install (try again)
if: ${{ steps.install.outcome == 'failure' }}
shell: bash
run: yarn install ${{ inputs.extra-flags }}
env:
HUSKY: "0"
24 changes: 24 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Y-Octo Rust setup"
description: "Rust setup, including cache configuration"
inputs:
components:
description: "Cargo components"
required: false
target:
description: "Cargo target"
required: true
toolchain:
description: "Rustup toolchain"
required: false
default: "stable"

runs:
using: "composite"
steps:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ inputs.toolchain }}
targets: ${{ inputs.target }}
components: ${{ inputs.components }}
- uses: Swatinem/rust-cache@v2
10 changes: 10 additions & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is used for tracking in GitHub project.
# See https://github.com/marketplace/actions/auto-assign-action

# Set to true to add reviewers to pull requests
addReviewers: false

# Set to true to add assignees to pull requests
addAssignees: author

runOnDraft: true
242 changes: 120 additions & 122 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,129 +1,127 @@
name: Benchmark

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths-ignore:
- "**/*.md"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
benchmark:
strategy:
matrix:
os: [ubuntu-latest, windows-latest] # `macos-latest` is too unstable to be useful for benchmark, the variance is always huge.
name: Run benchmark on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: master

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run Bench on Master Branch
run: |
cargo bench --bench codec_benchmarks --features bench -- --save-baseline master
cargo bench --bench array_ops_benchmarks --features bench -- --save-baseline master
# temp disable due to wired memory allocation issue in linux
# i cannot reproduce this issue in mac, but can reproduce in gce and ci
# cargo bench --bench map_ops_benchmarks --features bench -- --save-baseline master
cargo bench --bench text_ops_benchmarks --features bench -- --save-baseline master
cargo bench --bench update_benchmarks --features bench -- --save-baseline master
- name: Checkout master branch
uses: actions/checkout@v3
with:
clean: false
ref: ${{ github.event.pull_request.head.sha }}

- name: Run Bench on PR Branch
run: |
cargo bench --bench codec_benchmarks --features bench -- --save-baseline pr
cargo bench --bench array_ops_benchmarks --features bench -- --save-baseline pr
# cargo bench --bench map_ops_benchmarks --features bench -- --save-baseline pr
cargo bench --bench text_ops_benchmarks --features bench -- --save-baseline pr
cargo bench --bench update_benchmarks --features bench -- --save-baseline pr
- name: Upload benchmark results
uses: actions/upload-artifact@v3
with:
name: benchmark-results-${{ matrix.os }}
path: ./target/criterion

benchmark-compare:
runs-on: ubuntu-latest
name: Compare Benchmarks
needs:
- benchmark

steps:
- name: Install critcmp
uses: taiki-e/install-action@v2
with:
tool: critcmp

- name: Linux | Download PR benchmark results
uses: actions/download-artifact@v3
with:
name: benchmark-results-ubuntu-latest
path: ./target/criterion

- name: Linux | Compare benchmark results
shell: bash
run: |
echo "## Benchmark Results" >> summary.md
echo "### Linux" >> summary.md
echo "\`\`\`" >> summary.md
critcmp master pr >> summary.md
echo "\`\`\`" >> summary.md
echo "" >> summary.md
- name: Linux | Cleanup benchmark results
run: rm -rf ./target/criterion

- name: Windows | Download PR benchmark results
uses: actions/download-artifact@v3
with:
name: benchmark-results-windows-latest
path: ./target/criterion

- name: Windows | Compare benchmark results
shell: bash
run: |
echo "### Windows" >> summary.md
echo "\`\`\`" >> summary.md
critcmp master pr >> summary.md
echo "\`\`\`" >> summary.md
echo "" >> summary.md
cat summary.md > $GITHUB_STEP_SUMMARY
- name: Find Comment
# Check if the event is not triggered by a fork
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Benchmark Results

- name: Create or update comment
# Check if the event is not triggered by a fork
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
comment-id: ${{ steps.fc.outputs.comment-id }}
body-file: summary.md
benchmark:
strategy:
matrix:
os: [ubuntu-latest, windows-latest] # `macos-latest` is too unstable to be useful for benchmark, the variance is always huge.
name: Run benchmark on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Run Bench on main Branch
run: |
cargo bench --bench codec_benchmarks --features bench -- --save-baseline main
cargo bench --bench array_ops_benchmarks --features bench -- --save-baseline main
# temp disable due to wired memory allocation issue in linux
# i cannot reproduce this issue in mac, but can reproduce in gce and ci
# cargo bench --bench map_ops_benchmarks --features bench -- --save-baseline main
cargo bench --bench text_ops_benchmarks --features bench -- --save-baseline main
cargo bench --bench update_benchmarks --features bench -- --save-baseline main
- name: Checkout main branch
uses: actions/checkout@v3
with:
clean: false
ref: ${{ github.event.pull_request.head.sha }}

- name: Run Bench on PR Branch
run: |
cargo bench --bench codec_benchmarks --features bench -- --save-baseline pr
cargo bench --bench array_ops_benchmarks --features bench -- --save-baseline pr
# cargo bench --bench map_ops_benchmarks --features bench -- --save-baseline pr
cargo bench --bench text_ops_benchmarks --features bench -- --save-baseline pr
cargo bench --bench update_benchmarks --features bench -- --save-baseline pr
- name: Upload benchmark results
uses: actions/upload-artifact@v3
with:
name: benchmark-results-${{ matrix.os }}
path: ./target/criterion

benchmark-compare:
runs-on: ubuntu-latest
name: Compare Benchmarks
needs:
- benchmark

steps:
- name: Install critcmp
uses: taiki-e/install-action@v2
with:
tool: critcmp

- name: Linux | Download PR benchmark results
uses: actions/download-artifact@v3
with:
name: benchmark-results-ubuntu-latest
path: ./target/criterion

- name: Linux | Compare benchmark results
shell: bash
run: |
echo "## Benchmark Results" >> summary.md
echo "### Linux" >> summary.md
echo "\`\`\`" >> summary.md
critcmp main pr >> summary.md
echo "\`\`\`" >> summary.md
echo "" >> summary.md
- name: Linux | Cleanup benchmark results
run: rm -rf ./target/criterion

- name: Windows | Download PR benchmark results
uses: actions/download-artifact@v3
with:
name: benchmark-results-windows-latest
path: ./target/criterion

- name: Windows | Compare benchmark results
shell: bash
run: |
echo "### Windows" >> summary.md
echo "\`\`\`" >> summary.md
critcmp main pr >> summary.md
echo "\`\`\`" >> summary.md
echo "" >> summary.md
cat summary.md > $GITHUB_STEP_SUMMARY
- name: Find Comment
# Check if the event is not triggered by a fork
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: Benchmark Results

- name: Create or update comment
# Check if the event is not triggered by a fork
if: github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
comment-id: ${{ steps.fc.outputs.comment-id }}
body-file: summary.md
2 changes: 1 addition & 1 deletion .github/workflows/pr-auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
add-reviews:
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/[email protected]
- uses: kentaro-m/[email protected]
Loading

0 comments on commit 904395d

Please sign in to comment.