compile benchmark #1642
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: compile benchmark | |
on: | |
# push: | |
# branches: | |
# - master | |
schedule: | |
- cron: "* */24 * * *" | |
workflow_dispatch: | |
jobs: | |
#----start---- | |
collect: | |
runs-on: ubuntu-latest | |
outputs: | |
date: ${{ steps.sys-info.outputs.date }} | |
commit_id: ${{ steps.bm-info.outputs.commit_id }} | |
commit_id_short: ${{ steps.bm-info.outputs.commit_id_short }} | |
commit_time: ${{ steps.bm-info.outputs.commit_time }} | |
commit_user: ${{ steps.bm-info.outputs.commit_user }} | |
last_commit: ${{ steps.bm-info.outputs.last_commit }} | |
steps: | |
# collect sys | |
- name: collect common info | |
shell: bash | |
id: sys-info | |
run: echo "date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT | |
# checkout iot-benchmark | |
- name: checkout iot-benchmark | |
uses: actions/checkout@v4 | |
with: | |
path: iot-benchmark | |
repository: 'thulab/iot-benchmark' | |
ref: 'master' | |
fetch-depth: 0 | |
# collect iot-benchmark | |
- name: collect Benchmark information | |
id: bm-info | |
run: | | |
cd ${{ github.workspace }}/iot-benchmark | |
echo "commit_id=$( git rev-parse HEAD )" >> "$GITHUB_OUTPUT" | |
echo commit_id is $(git rev-parse HEAD) | |
echo "commit_id_short=$( git rev-parse --short HEAD )" >> "$GITHUB_OUTPUT" | |
echo "commit_time=$(git log -n1 --pretty='format:%cd' --date=iso)" >> "$GITHUB_OUTPUT" | |
echo "commit_user=$(git log | head -n 2 | tail -n 1 | cut -d ' ' -f 2)" >> "$GITHUB_OUTPUT" | |
echo "last_commit=$(cat .github/release_history.txt | tail -n 1)" >> "$GITHUB_OUTPUT" | |
echo last_commit is $(cat .github/release_history.txt | tail -n 1) | |
# compare | |
- name: check check's results | |
run: | | |
echo "txt pid: ${{ steps.bm-info.outputs.last_commit }}" | |
echo "res pid: ${{ steps.bm-info.outputs.commit_id }}" | |
echo "last commit user: ${{ steps.bm-info.outputs.commit_user }}" | |
# equal means no update | |
# "exit 0" is exits normally,"exit other" is exception exit | |
- name: check check's results | |
if: ${{ steps.bm-info.outputs.commit_id == steps.bm-info.last_commit || steps.bm-info.outputs.commit_user == 'github-actions[bot]' }} | |
run: exit 1 | |
#----end---- | |
#----start---- | |
create-release: | |
runs-on: ubuntu-latest | |
needs: [collect] | |
steps: | |
- name: Create release | |
id: create-release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ needs.collect.outputs.date }} ${{ needs.collect.outputs.commit_id_short }} java${{ matrix.java_version }} | |
tag: ${{ needs.collect.outputs.date }}-${{ needs.collect.outputs.commit_id_short }}-java${{ matrix.java_version }} | |
prerelease: false | |
draft: false | |
body: | | |
Auto build... | |
Commit Time: ${{ needs.collect.outputs.commit_time }} | |
Commit ID: ${{ needs.collect.outputs.commit_id }} | |
Java Version: java${{ matrix.java_version }} | |
#----end---- | |
#----start---- | |
compile: | |
runs-on: ubuntu-latest | |
needs: [collect,create-release] | |
strategy: | |
fail-fast: false | |
max-parallel: 20 | |
matrix: | |
java_version: [ 8 ] | |
release_db: [ iotdb-1.0,iotdb-1.1,iotdb-1.3,iotdb-2.0,influxdb,influxdb-2.0,timescaledb,timescaledb-cluster ] | |
steps: | |
# set java | |
- name: Set java ${{ matrix.java_version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ matrix.java_version }} | |
# checkout iot-benchmark | |
- name: checkout iot-benchmark | |
uses: actions/checkout@v4 | |
with: | |
path: iot-benchmark | |
repository: 'thulab/iot-benchmark' | |
ref: 'master' | |
fetch-depth: 0 | |
# compile benchmark | |
- name: Build benchmark binaries | |
id: compile-benchmark | |
run: | | |
cd ${{ github.workspace }}/iot-benchmark | |
git checkout ${{ needs.collect.outputs.commit_id }} | |
mvn clean package -DskipTests -am -pl core,${{ matrix.release_db }} | |
mv ${{ github.workspace }}/iot-benchmark/${{ matrix.release_db }}/target/iot-benchmark-${{ matrix.release_db }}.zip ${{ github.workspace }}/iot-benchmark-${{ matrix.release_db }}-java${{ matrix.java_version }}.zip | |
ls -l ${{ github.workspace }} | |
du -s ${{ github.workspace }}/iot-benchmark-${{ matrix.release_db }}-java${{ matrix.java_version }}.zip | |
#---upload | |
- name: Upload iot-benchmark-${{ matrix.release_db }}-java${{ matrix.java_version }}.zip using ${{ matrix.java_version }} | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ needs.collect.outputs.date }} ${{ needs.collect.outputs.commit_id_short }} java${{ matrix.java_version }} | |
tag: ${{ needs.collect.outputs.date }}-${{ needs.collect.outputs.commit_id_short }}-java${{ matrix.java_version }} | |
prerelease: false | |
draft: false | |
allowUpdates: true | |
artifactErrorsFailBuild: true | |
artifacts: "${{ github.workspace }}/iot-benchmark-${{ matrix.release_db }}-java${{ matrix.java_version }}.zip" | |
#----end---- | |
#----start---- | |
push-commit: | |
runs-on: ubuntu-latest | |
needs: [collect,create-release,compile] | |
steps: | |
# checkout iot-benchmark | |
- name: checkout iot-benchmark | |
uses: actions/checkout@v4 | |
with: | |
path: iot-benchmark | |
repository: 'thulab/iot-benchmark' | |
ref: 'master' | |
fetch-depth: 0 | |
# git push commit | |
- name: push commit | |
env: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd ${{ github.workspace }}/iot-benchmark | |
git config --local user.email "${{ secrets.MAIL_FOR_BOT }}" | |
git config --local user.name "github-actions[bot]" | |
echo ${{ needs.collect.outputs.commit_id }} >> .github/release_history.txt | |
git add .github/release_history.txt | |
git commit -m "${{ needs.collect.outputs.date }}-${{ needs.collect.outputs.commit_id_short }}" | |
git push -u origin master | |
#----end---- |