Merge pull request #4 from CritasWang/master #1
This file contains hidden or 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: test build rel/0.12 | ||
|
Check failure on line 1 in .github/workflows/test-build_rel0.12.yml
|
||
| on: | ||
| # push: | ||
| # branches: | ||
| # - master | ||
| workflow_dispatch: | ||
| jobs: | ||
| #-------- | ||
| check-commit: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| max-parallel: 20 | ||
| matrix: | ||
| iotdb_version: [ rel/0.12 ] | ||
| outputs: | ||
| check_date: ${{ steps.sys-info.outputs.date }} | ||
| commit_id: ${{ steps.iotdb-info.outputs.commit_id }} | ||
| commit_time: ${{ steps.iotdb-info.outputs.commit_time }} | ||
| branch: ${{ steps.iotdb-info.outputs.branch }} | ||
| version: ${{ matrix.iotdb_version }} | ||
| filename_version: ${{ steps.iotdb-info.outputs.filename_version }} | ||
| steps: | ||
| # 收集公共信息 | ||
| - name: collect common info | ||
| shell: bash | ||
| id: sys-info | ||
| run: echo "::set-output name=date::$(date +"%Y-%m-%d")" | ||
| # clone iotdb | ||
| - name: checkout apache/iotdb | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| path: iotdb | ||
| repository: 'apache/iotdb' | ||
| ref: ${{ matrix.iotdb_version }} | ||
| fetch-depth: 0 | ||
| # 收集iotdb信息 | ||
| - name: collect IoTDB information | ||
| id: iotdb-info | ||
| run: | | ||
| cd ${{ github.workspace }}/iotdb | ||
| echo "::set-output name=commit_id::$(git log -n 1 | head -n 1 | cut -d ' ' -f 2)" | ||
| echo "::set-output name=commit_time::$(git log -n1 --pretty='format:%cd' --date=iso)" | ||
| echo "::set-output name=branch::$(git branch |grep ^*|cut -d ' ' -f 2)" | ||
| echo "::set-output name=filename_version::$(cat pom.xml | grep -e '^ <version>' | sed 's# ##g' | sed 's#<version>##g' | sed 's#</version>##g')" | ||
| # clone 本程序 | ||
| - name: checkout iotdb-daily-build | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| path: iotdb-daily-build | ||
| repository: 'xiaoyekanren/iotdb-daily-build' | ||
| ref: master | ||
| fetch-depth: 0 | ||
| # clone 本程序 db分支 | ||
| - name: Checkout db for save results | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| path: db | ||
| repository: 'xiaoyekanren/iotdb-daily-build' | ||
| ref: db | ||
| fetch-depth: 0 | ||
| # 检查db文件,如果有commit就更新db,并开始后续测试 | ||
| - name: check | ||
| id: check-commit | ||
| env: | ||
| PYTHONPATH: $PYTHONPATH:${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012 | ||
| run: | | ||
| cd ${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012 | ||
| result=$(python3 check_commit.py '${{ github.workspace }}/db/db/db.db' '${{ steps.iotdb-info.outputs.branch }}' '${{ steps.iotdb-info.outputs.commit_id }}' '${{ steps.iotdb-info.outputs.commit_time }}') | ||
| echo "::set-output name=result::$(echo $result)" | ||
| echo $result | ||
| # 判断是stop还是update | ||
| # exit 0 是正常退出,exit 其他数 是错误退出 | ||
| - name: check check's results | ||
| if: ${{ steps.check-commit.outputs.result == 'stop' }} | ||
| run: exit 0 | ||
| ## 上传db文件 | ||
| # - name: upload db | ||
| # if: ${{ steps.check-commit.outputs.result == 'update' }} | ||
| # env: | ||
| # github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| # run: | | ||
| # cd ${{ github.workspace }}/db | ||
| # git config --local user.email "876670773+github-actions[bot]@qq.com" | ||
| # git config --local user.name "github-actions[bot]" | ||
| # cd db | ||
| # git add db.db | ||
| # git commit -m "${{steps.sys-info.outputs.date}} github-actions[bot] push update " | ||
| # git push -u origin db | ||
| ## debug | ||
| # - name: check | ||
| # id: check-commit | ||
| # env: | ||
| # PYTHONPATH: $PYTHONPATH:${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012 | ||
| # run: | | ||
| # cd ${{ github.workspace }}/iotdb-daily-build/action-test-build_rel012 | ||
| # python3 test_db.py '${{ github.workspace }}/db/db/db.db' 'select * from commit_last' | ||
| - name: for Collapse code | ||
| run: echo "whoami,hhahha" | ||
| #-------- | ||
| remote-mkdir-path: | ||
| if: ${{ steps.check-commit.outputs.result != 'stop' }} | ||
| needs: [ check-commit ] | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| remote_path: ${{ steps.ready-upload.outputs.dest_path }} | ||
| steps: | ||
| # 准备上传用信息 | ||
| - name: ready to upload | ||
| id: ready-upload | ||
| run: | | ||
| echo "::set-output name=dest_path::$(echo /home/ubuntu/web/downloads/${{ matrix.java_version }})" | ||
| # 创建对应文件夹 | ||
| - name: ssh to mkdir | ||
| uses: appleboy/ssh-action@master | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} | ||
| with: | ||
| host: ${{ secrets.IOTDBFUTURE_HOST }} | ||
| username: ${{ secrets.IOTDBFUTURE_HOST_USER }} | ||
| key: ${{ secrets.IOTDBFUTURE_TOKEN }} | ||
| port: ${{ secrets.IOTDBFUTURE_HOST_PORT }} | ||
| script: mkdir -p ${{ steps.ready-upload.outputs.dest_path }} | ||
| #-------- | ||
| create-release: | ||
| needs: collect | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
| steps: | ||
| - name: Create release java-8 | ||
| id: create-release | ||
| uses: actions/create-release@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ needs.collect.outputs.date }}-apache-iotdb | ||
| release_name: ${{ needs.collect.outputs.date }} apache iotdb | ||
| body: | | ||
| ${{ needs.check-commit.outputs.check_date }}, | ||
| ${{ needs.check-commit.outputs.commit_id }}, | ||
| ${{ needs.check-commit.outputs.commit_time }}, | ||
| ${{ needs.check-commit.outputs.branch }}, | ||
| ${{ needs.check-commit.outputs.version }}, | ||
| ${{ needs.check-commit.outputs.filename_version }} | ||
| draft: false | ||
| prerelease: false | ||
| #-------- | ||
| build-in-linux: | ||
| if: ${{ steps.check-commit.outputs.result != 'stop' }} | ||
| needs: [ check-commit,remote-mkdir-path,create-release ] | ||
| strategy: | ||
| fail-fast: false | ||
| max-parallel: 20 | ||
| matrix: | ||
| java_version: [ 8,11 ] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # set java | ||
| - name: Set java 8 | ||
| uses: actions/setup-java@v1 | ||
| with: | ||
| java-version: ${{ matrix.java_version }} | ||
| # clone iotdb | ||
| - name: Checkout apache/iotdb | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| path: iotdb | ||
| repository: 'apache/iotdb' | ||
| ref: ${{ needs.check-commit.outputs.branch }} | ||
| fetch-depth: 0 | ||
| # 编译IoTDB | ||
| - name: compile iotdb | ||
| run: | | ||
| cd ${{ github.workspace }}/iotdb | ||
| git checkout ${{ needs.check-commit.outputs.commit_id }} | ||
| mvn clean package -DskipTests | ||
| # 上传iotdb包到远程服务器 | ||
| - name: scp to upload file | ||
| uses: appleboy/scp-action@master | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| host: ${{ secrets.IOTDBFUTURE_HOST }} | ||
| username: ${{ secrets.IOTDBFUTURE_HOST_USER }} | ||
| port: ${{ secrets.IOTDBFUTURE_HOST_PORT }} | ||
| key: ${{ secrets.IOTDBFUTURE_TOKEN }} | ||
| source: ${{ github.workspace }}/iotdb/distribution/target/apache-iotdb-${{ needs.check-commit.outputs.filename_version }}-all-bin.zip | ||
| target: ${{ steps.ready-upload.outputs.dest_path }} | ||
| #-------- | ||
| build-in-win: | ||
| if: ${{ steps.check-commit.outputs.result != 'stop' }} | ||
| needs: [ check-commit ] | ||
| strategy: | ||
| fail-fast: false | ||
| max-parallel: 20 | ||
| matrix: | ||
| java_version: [ 8,11 ] | ||
| os: [ windows-2022 ] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| # 设置java | ||
| - name: Set java ${{ matrix.java }} | ||
| uses: actions/setup-java@v1 | ||
| with: | ||
| java-version: ${{ matrix.java_version }} | ||
| # 从iotdb-daily-build-dependence下载已经编译好的boost | ||
| - name: download & unpack & install -> boost | ||
| shell: cmd | ||
| run: | | ||
| C:\msys64\usr\bin\wget.exe -O ${{ github.workspace }}/boost_1_78_0-bin.7z https://github.com/xiaoyekanren/iotdb-daily-build-dependence/releases/download/release-depend-bin/boost_1_78_0-bin.7z | ||
| 7z x ${{ github.workspace }}/boost_1_78_0-bin.7z -o${{ github.workspace }}/boost_1_78_0 | ||
| # C:\msys64\usr\bin\wget.exe -O ${{ github.workspace }}/boost_1_78_0.zip https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip | ||
| # 7z x ${{ github.workspace }}/boost_1_78_0.zip -o${{ github.workspace }}/boost_1_78_0 | ||
| # cd ${{ github.workspace }}/boost_1_78_0/boost_1_78_0 | ||
| # .\bootstrap.bat | ||
| # .\b2 | ||
| # echo "::set-output name=include::$(git branch |grep ^*|cut -d ' ' -f 2)" | ||
| # echo "::set-output name=library::$(git branch |grep ^*|cut -d ' ' -f 2)" | ||
| # 下载解压flex和bison | ||
| - name: download & unpack flex&bison | ||
| shell: cmd | ||
| run: | | ||
| C:\msys64\usr\bin\wget.exe -O ${{ github.workspace }}/win_flex_bison-latest.zip https://jaist.dl.sourceforge.net/project/winflexbison/win_flex_bison-latest.zip | ||
| 7z x ${{ github.workspace }}/win_flex_bison-latest.zip -o${{ github.workspace }}/win_flex_bison-latest | ||
| # chcoc安装openssl | ||
| - name: install openssl | ||
| run: | | ||
| choco install openssl | ||
| # clone iotdb | ||
| - name: Checkout apache/iotdb | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| path: iotdb | ||
| repository: 'apache/iotdb' | ||
| ref: ${{ needs.check-commit.outputs.branch }} | ||
| fetch-depth: 0 | ||
| # 编译iotdb client-cpp | ||
| - name: compile client-cpp | ||
| shell: cmd | ||
| env: | ||
| boost-include-dir: ${{ github.workspace }}\boost_1_78_0\boost_1_78_0 | ||
| boost-library.dir: ${{ github.workspace }}\boost_1_78_0\boost_1_78_0\stage\lib | ||
| cmake-url: https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-windows-x86_64.zip | ||
| cmake-root-dir: ${{ github.workspace }}\iotdb\compile-tools\thrift\target\cmake-3.23.1-windows-x86_64 | ||
| run: | | ||
| cd ${{ github.workspace }}\iotdb | ||
| set Path=%Path%;${{ github.workspace }}\win_flex_bison-latest | ||
| set Path | ||
| mvn package -Dcmake.generator="Visual Studio 17 2022" -P compile-cpp -pl server,client-cpp,example/client-cpp-example -am -DskipTests -Dboost.include.dir="%boost-include-dir%" -Dboost.library.dir="%boost-library.dir%" -Dcmake.url="%cmake-url%" -Dcmake.root.dir="%cmake-root-dir%" | ||
| # 压缩example文件 | ||
| - name: compress client-cpp-example | ||
| shell: bash | ||
| run: | | ||
| cd iotdb/example/client-cpp-example/target | ||
| 7z a client-cpp-example-${{ steps.iotdb-info.outputs.version }}-cpp-windows-x86_64.zip client CMakeLists.txt SessionExample.cpp | ||
| # 上传iotdb包到远程服务器 | ||
| - name: scp to upload file | ||
| uses: appleboy/scp-action@master | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| host: ${{ secrets.IOTDBFUTURE_HOST }} | ||
| username: ${{ secrets.IOTDBFUTURE_HOST_USER }} | ||
| port: ${{ secrets.IOTDBFUTURE_HOST_PORT }} | ||
| key: ${{ secrets.IOTDBFUTURE_TOKEN }} | ||
| source: ${{ github.workspace }}/iotdb/example/client-cpp-example/target/client-cpp-example-${{ needs.check-commit.outputs.filename_version }}-cpp-windows-x86_64.zip | ||
| target: ${{ steps.ready-upload.outputs.dest_path }} | ||