[feat] Add version metric. #2669
Workflow file for this run
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: CI Build | |
| on: | |
| push: | |
| branches: [ "**" ] | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: [ "**" ] | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| build: | |
| if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Copy dingofs repository | |
| run: | | |
| echo "Move dingofs repository" | |
| sudo cp -r /home/runner/work/dingofs/dingofs /mnt/ | |
| sudo chown $USER:$USER /mnt/dingofs | |
| - name: Configure Docker data-root | |
| run: | | |
| sudo systemctl stop docker | |
| sudo systemctl stop docker.socket | |
| sudo mkdir -p /mnt/docker | |
| echo '{ "data-root": "/mnt/docker" }' | sudo tee /etc/docker/daemon.json | |
| if [ -d /var/lib/docker ]; then | |
| sudo mv /var/lib/docker /mnt/docker || true | |
| fi | |
| sudo systemctl start docker.socket | |
| sudo systemctl start docker | |
| docker info | grep "Docker Root Dir" | |
| echo "check disk space" | |
| df -h | |
| - name: Pull dingodatabase/dingo-eureka:rocky9-fs | |
| run: | | |
| docker pull dingodatabase/dingo-eureka:rocky9-fs | |
| - name: Init build script | |
| run: | | |
| cat <<EOF > /mnt/dingofs/build.sh | |
| #!/bin/bash | |
| set -x | |
| set -e | |
| cd / && git clone --branch main --single-branch https://github.com/dingodb/dingo-sdk.git && cd dingo-sdk && \ | |
| git submodule sync --recursive && git submodule update --init --recursive && \ | |
| mkdir build && cd build && cmake -DTHIRD_PARTY_INSTALL_PATH=/root/.local/dingo-eureka -DCMAKE_INSTALL_PREFIX=/root/.local/dingo-sdk -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SDK_EXAMPLE=OFF -DBUILD_BENCHMARK=OFF -DBUILD_PYTHON_SDK=OFF -DBUILD_INTEGRATION_TESTS=OFF -DBUILD_UNIT_TESTS=OFF .. && \ | |
| make -j16 && make install && export DINGOSDK_INSTALL_PATH=/root/.local/dingo-sdk | |
| cd /opt/dingofs/ | |
| git config --global --add safe.directory /opt/dingofs | |
| make file_dep | |
| make file_build only=//src/* release=1 unit_tests=ON | |
| # check if the build is successful | |
| if [ $? -ne 0 ] | |
| then | |
| echo "build failed" | |
| exit -1 | |
| fi | |
| make file_deploy_config | |
| # check install is successful | |
| if [ $? -ne 0 ] | |
| then | |
| echo "install failed" | |
| exit -1 | |
| fi | |
| tar -czvf dingofs.tar.gz -C scripts/docker/rocky9 dingofs | |
| # check size of tar file | |
| ls -lh dingofs.tar.gz | |
| # generate checksum file for the tar file and other binary files | |
| sha256sum scripts/docker/rocky9/dingofs/build/bin/dingo-client > dingo-client.sha256 | |
| sha256sum scripts/docker/rocky9/dingofs/build/bin/dingo-cache > dingo-cache.sha256 | |
| sha256sum scripts/docker/rocky9/dingofs/build/bin/dingo-mds > dingo-mds.sha256 | |
| sha256sum scripts/docker/rocky9/dingofs/build/bin/dingo-mds-client > dingo-mds-client.sha256 | |
| echo "DingoFS Build finished" | |
| EOF | |
| chmod +x /mnt/dingofs/build.sh | |
| - name: Record event type | |
| run: | | |
| branchName=$(echo "${{ github.ref_name }}") | |
| echo "branch name is: $branchName" | |
| echo "$branchName" > branch_name.txt | |
| commitId="${{ github.sha }}" | |
| shortCommitId=${commitId:0:7} | |
| echo "commit id is: $shortCommitId" | |
| echo "$shortCommitId" > commit_id.txt | |
| # save long commit id to file | |
| echo "$commitId" > commitId.txt | |
| echo "hello dingofs" > event.txt | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| echo "pull_request" > event.txt | |
| elif [ "${{ github.event_name }}" == "push" ]; then | |
| if [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| echo "tag" > event.txt | |
| tagInfo=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///') | |
| echo "$tagInfo" > tag_name.txt | |
| echo "TAG_NAME=$tagInfo" >> $GITHUB_ENV | |
| else | |
| echo "push" > event.txt | |
| echo "TAG_NAME=latest" >> $GITHUB_ENV | |
| fi | |
| fi | |
| - name: Save event type info | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: event | |
| path: event.txt | |
| compression-level: 0 | |
| - name: Save tag name info | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tag_name | |
| path: tag_name.txt | |
| compression-level: 0 | |
| - name: Save branch name info | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: branch_name | |
| path: branch_name.txt | |
| compression-level: 0 | |
| - name: Save commit id info | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: commit_id | |
| path: commit_id.txt | |
| compression-level: 0 | |
| - name: Build DingoFS | |
| run: | | |
| echo "Build DingoFS" | |
| docker run --name release-dingofs --rm -v /mnt/dingofs:/opt/dingofs/ dingodatabase/dingo-eureka:rocky9-fs /opt/dingofs/build.sh | |
| - name: Copy artifactory to another workflow | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dingofs | |
| path: /mnt/dingofs/dingofs.tar.gz | |
| compression-level: 0 | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} | |
| with: | |
| files: | | |
| commitId.txt | |
| /mnt/dingofs/scripts/docker/rocky9/dingofs/build/bin/dingo-client | |
| /mnt/dingofs/scripts/docker/rocky9/dingofs/build/bin/dingo-cache | |
| /mnt/dingofs/scripts/docker/rocky9/dingofs/build/bin/dingo-mds | |
| /mnt/dingofs/scripts/docker/rocky9/dingofs/build/bin/dingo-mds-client | |
| /mnt/dingofs/dingo-client.sha256 | |
| /mnt/dingofs/dingo-cache.sha256 | |
| /mnt/dingofs/dingo-mds.sha256 | |
| /mnt/dingofs/dingo-mds-client.sha256 | |
| name: ${{ env.TAG_NAME }} | |
| tag_name: ${{ env.TAG_NAME }} | |
| token: ${{ secrets.GH_TOKEN }} | |