Skip to content

Commit

Permalink
Merge pull request #443 from xiaoyekanren/master
Browse files Browse the repository at this point in the history
optimize workflow,update dependencies
  • Loading branch information
xiaoyekanren authored Sep 10, 2024
2 parents c51a4f8 + 6c6f09f commit 57bc71b
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 118 deletions.
212 changes: 97 additions & 115 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ on:
- cron: "* */24 * * *"
workflow_dispatch:
jobs:
#--------
check-commit:
#----start----
collect:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 20
matrix:
java_version: [ 8 ]
# java_version: [ 8,11 ]
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 thulab/iot-benchmark
uses: actions/checkout@v2
- name: checkout iot-benchmark
uses: actions/checkout@v4
with:
path: iot-benchmark
repository: 'thulab/iot-benchmark'
Expand All @@ -31,133 +37,108 @@ jobs:
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 $(git rev-parse HEAD)
# check update
- name: check
id: check-old-commit
run: |
cd ${{ github.workspace }}/iot-benchmark
echo "last_commit=$(cat .github/release_history.txt | tail -n 1)" >> "$GITHUB_OUTPUT"
echo $(cat .github/release_history.txt | tail -n 1)
echo last_commit is $(cat .github/release_history.txt | tail -n 1)
# compare
- name: check check's results
run: |
echo "txt pid: ${{ steps.check-old-commit.outputs.last_commit }}"
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.check-old-commit.outputs.last_commit || steps.bm-info.outputs.commit_user == 'github-actions[bot]' }}
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@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java_version }}
# # checkout iotdb
# - name: Checkout iotdb-1.0
# uses: actions/checkout@v2
# with:
# path: iotdb-1.0
# repository: 'apache/iotdb'
# ref: rel/1.0
# fetch-depth: 0
# # compile iotdb
# - name: compile iotdb
# run: |
# cd ${{ github.workspace }}/iotdb-1.0
# mvn install -DskipTests -am -pl distribution
# 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
mvn clean package -am -pl core,influxdb,influxdb-2.0,tdengine,timescaledb,iotdb-1.0,iotdb-1.1,iotdb-1.3 -DskipTests
# get time
- name: collect common info
shell: bash
id: sys-info
run: |
echo "date=$(date +"%Y-%m-%d")" >> "$GITHUB_OUTPUT"
# create release
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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:
tag_name: ${{ steps.sys-info.outputs.date }}-${{ steps.bm-info.outputs.commit_id_short }}-java${{ matrix.java_version }}
release_name: ${{ steps.sys-info.outputs.date }} ${{ steps.bm-info.outputs.commit_id_short }} java${{ matrix.java_version }}
body: |
Auto build...
Commit Time: ${{ steps.bm-info.outputs.commit_time }}
Commit ID: ${{ steps.bm-info.outputs.commit_id }}
Java Version: java${{ matrix.java_version }}
draft: false
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
#---1.0
- name: Upload benchmark-iotdb-1.0
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0.zip
asset_name: benchmark-iotdb-1.0-java${{ matrix.java_version }}.zip
asset_content_type: application/zip
#---1.1
- name: Upload benchmark-iotdb-1.1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/iot-benchmark/iotdb-1.1/target/iot-benchmark-iotdb-1.1.zip
asset_name: benchmark-iotdb-1.1-java${{ matrix.java_version }}.zip
asset_content_type: application/zip
#---1.3
- name: Upload benchmark-iotdb-1.3
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/iot-benchmark/iotdb-1.3/target/iot-benchmark-iotdb-1.3.zip
asset_name: benchmark-iotdb-1.3-java${{ matrix.java_version }}.zip
asset_content_type: application/zip
#---influxdb
- name: Upload benchmark-influxdb
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/iot-benchmark/influxdb/target/iot-benchmark-influxdb.zip
asset_name: benchmark-influxdb-java${{ matrix.java_version }}.zip
asset_content_type: application/zip
#---influxdb2.0
- name: Upload benchmark-influxdb2.0
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/iot-benchmark/influxdb-2.0/target/iot-benchmark-influxdb-2.0.zip
asset_name: benchmark-influxdb-2.0-java${{ matrix.java_version }}.zip
asset_content_type: application/zip
#---timescaledb
- name: Upload benchmark-timescaledb
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/iot-benchmark/timescaledb/target/iot-benchmark-timescaledb.zip
asset_name: benchmark-timescaledb-java${{ matrix.java_version }}.zip
asset_content_type: application/zip
path: iot-benchmark
repository: 'thulab/iot-benchmark'
ref: 'master'
fetch-depth: 0
# git push commit
- name: push commit
env:
Expand All @@ -166,7 +147,8 @@ jobs:
cd ${{ github.workspace }}/iot-benchmark
git config --local user.email "${{ secrets.MAIL_FOR_BOT }}"
git config --local user.name "github-actions[bot]"
echo ${{ steps.bm-info.outputs.commit_id }} >> .github/release_history.txt
echo ${{ needs.collect.outputs.commit_id }} >> .github/release_history.txt
git add .github/release_history.txt
git commit -m "${{ steps.sys-info.outputs.date }}-${{ steps.bm-info.outputs.commit_id_short }}"
git commit -m "${{ needs.collect.outputs.date }}-${{ needs.collect.outputs.commit_id_short }}"
git push -u origin master
#----end----
5 changes: 3 additions & 2 deletions .github/workflows/release_history_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
echo "RELEASE_COMMIT_ID=5e754fe5bf1258385f4701bc1923e328a1c01292" >> $GITHUB_ENV
echo "the version you want to release is ${{ env.RELEASE_COMMIT_ID }}"
- name: checkout thulab/iot-benchmark
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: iot-benchmark
repository: 'thulab/iot-benchmark'
Expand All @@ -38,8 +38,9 @@ jobs:
echo $(git rev-parse HEAD)
# set java
- name: Set java ${{ matrix.java_version }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java_version }}
# compile benchmark
- name: Build benchmark binaries
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spotless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: iot-benchmark
- name: spotless-check
Expand Down

0 comments on commit 57bc71b

Please sign in to comment.