Skip to content

Update ion-java-performance-regression-detector.yml #441

Update ion-java-performance-regression-detector.yml

Update ion-java-performance-regression-detector.yml #441

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Ion Java performance regression detector
on:
[pull_request, push]
env:
data_size: '50000'
test_data_id: 'generated-test-data'
jobs:
generate-test-data:
name: Generate Test Data
runs-on: ubuntu-latest
steps:
- name: Checkout ion-data-generator
uses: actions/checkout@v4
with:
repository: amazon-ion/ion-data-generator
ref: main
- name: Build ion-data-generator
run: mvn clean install
- name: Generate test data
env:
jar_file: target/ion-data-generator-1.0-SNAPSHOT.jar
schema_dir: tst/com/amazon/ion/workflow
run: |
mkdir -p testData
for test in nestedStruct nestedList sexp realWorldDataSchema01 realWorldDataSchema02 realWorldDataSchema03
do
java -jar $jar_file generate -S ${{env.data_size}} --input-ion-schema $schema_dir/${test}.isl testData/${test}.10n
done
- name: Upload test Ion Data to artifacts
uses: actions/upload-artifact@v3
with:
name: ${{env.test_data_id}}
path: testData
detect-regression:
name: Detect Regression
runs-on: ubuntu-latest
needs: generate-test-data
strategy:
matrix:
test-data: ['nestedStruct', 'nestedList', 'sexp', 'realWorldDataSchema01', 'realWorldDataSchema02', 'realWorldDataSchema03']
usage-patterns: [' read --api dom --format ion_binary --results-format ion ', ' read --api streaming --format ion_binary --results-format ion ', ' write --api streaming --format ion_binary --results-format ion ', ' read --api streaming --format json --results-format ion ']
fail-fast: false
steps:
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 11
- name: Checkout ion-java-benchmark-cli
uses: actions/checkout@v4
with:
repository: amazon-ion/ion-java-benchmark-cli
ref: master
path: ion-java-benchmark-cli
- name: Checkout ion-java from the previous commit
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
path: baseline
- name: Checkout ion-java from the new commit.
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
path: new
- name: Download test Ion Data from artifacts
uses: actions/download-artifact@v3
with:
name: generated-test-data
path: testData
# Get the benchmark results from the base commit
- name: Build ion-java from the base commit
working-directory: baseline
run: |
git submodule init && git submodule update && ./gradlew clean publishToMavenLocal
- name: Benchmark ion-java from the base commit
working-directory: ion-java-benchmark-cli
run: |
mvn clean install
java -jar target/ion-java-benchmark-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar ${{matrix.usage-patterns}} ${{matrix.test-data}}
- name: Build ion-java from the new commit
working-directory: new
run: |
git submodule init && git submodule update && ./gradlew clean publishToMavenLocal
- name: Benchmark ion-java from the new commit
working-directory: ion-java-benchmark-cli
run: |
mvn clean install
java -jar target/ion-java-benchmark-cli-0.0.1-SNAPSHOT-jar-with-dependencies.jar ${{matrix.usage-patterns}} ./testData/${{matrix.test-data}}
#Detect regression
- name: Upload benchmark results to artifacts
uses: actions/upload-artifact@v3
with:
name: Benchmark result
path: benchmarkResults