Revert Cargo.toml and enhance release action #388
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Performance Benchmark | |
on: | |
push: | |
branches: | |
- main | |
- 'develop-**' | |
- 'bugfix/**' | |
- 'feature/**' | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
bench: | |
name: Performance Benchmark | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, '[bench]')" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: cargo build --release | |
- name: Benchmark for each functions | |
run: cargo bench | |
files: | |
name: Benchmark with a large file | |
runs-on: ubuntu-latest | |
if: "contains(github.event.head_commit.message, '[bench]')" | |
strategy: | |
matrix: | |
include: | |
- name: regex_match | |
cmd: teip -og '.*sshd' < test_secure | |
- name: onig_match | |
cmd: teip -Gog '.*sshd' < test_secure | |
- name: convert_date | |
cmd: teip -c1-15 -- date -f- +%s < test_secure | |
- name: csv | |
cmd: teip --csv -f 2 -- tr '[:print:]' '@' < test.csv | |
# same as: awk '{gsub(".","@",$2);print}' FS=, OFS=, < test.csv | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install musl-tools autoconf autotools-dev valgrind | |
- name: Build | |
run: | | |
rustup target add x86_64-unknown-linux-musl | |
CFLAGS="-fPIE" CC="musl-gcc -static" cargo build --verbose --release --target x86_64-unknown-linux-musl | |
mv target/x86_64-unknown-linux-musl/release/teip target/release | |
- name: Prepare benchmarking | |
run: | | |
wget https://github.com/sharkdp/hyperfine/releases/download/v1.9.0/hyperfine_1.9.0_amd64.deb | |
sudo dpkg -i ./hyperfine_1.9.0_amd64.deb | |
wget https://github.com/greymd/test_files/raw/v1.0.0/logs/test_secure.gz | |
gzip -d ./test_secure.gz | |
wget https://github.com/greymd/test_files/raw/v1.0.0/xsv/1000000_Sales_Records.csv.gz | |
zcat 1000000_Sales_Records.csv.gz | awk '{print}' > test.csv # Filtered by AWK to add trailing newline | |
- name: Benchmark for a large file | |
run: | | |
hyperfine --export-json ./${{ matrix.name }}.json "./target/release/${{ matrix.cmd }}" | |
- name: Save benchmark result for processing time | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.name }} | |
path: ./${{ matrix.name }}.json | |
- name: Show benchmark result for processing time | |
run: | | |
cat ./${{ matrix.name }}.json |