diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1fbc83c75af..f2e45543171 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -59,7 +59,12 @@ jobs: -DCMAKE_C_COMPILER=clang \ -DENABLE_ASAN=on \ -B build/ + - name: Make with one thread + if: matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7' + run: | + cmake --build build/ - name: Make + if: matrix.compiler != 'gcc-9.2' || matrix.os != 'centos7' run: | cmake --build build/ -j $(nproc) - name: CTest with multiple thread diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 406a9398204..13f062068f1 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -4,6 +4,7 @@ on: schedule: - cron: '0 18 * * *' push: + # Releases are all branch based, and the branch package here is for testing. branches: - 'v[0-9]+.*' paths-ignore: @@ -30,10 +31,20 @@ jobs: shell: bash - name: Compute version id: version + env: + CPACK_OUTPUT_DIR: build/cpack_output run: | [[ "${{ github.event_name }}" == "push" ]] && \ echo "::set-output name=version::$(cut -d/ -f3 <<< ${{ github.ref }})" || \ - echo "::set-output name=version::nightly" + (echo "::set-output name=version::nightly" + cd $CPACK_OUTPUT_DIR && \ + filename=$(find . -type f \( -iname \*.deb -o -iname \*.rpm \) -exec basename {} \;) + echo "::set-output name=filepath::$CPACK_OUTPUT_DIR/$filename") + shell: bash + - name: upload oss + if: github.event_name != 'push' + run: | + ./ci/scripts/upload-oss.sh OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} OSS_ID=${{ secrets.OSS_ID }} OSS_SECRET=${{ secrets.OSS_SECRET }} filepath=${{ steps.version.outputs.filepath }} nightly=true shell: bash - uses: actions/upload-artifact@v1 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7fd4716dc64..c7193469c01 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,12 +40,9 @@ jobs: run: | ./ci/scripts/upload-github-release-asset.sh github_token=${{ secrets.GITHUB_TOKEN }} repo=${{ github.repository }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.filepath }} ./ci/scripts/upload-github-release-asset.sh github_token=${{ secrets.GITHUB_TOKEN }} repo=${{ github.repository }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.shafilepath }} + ./ci/scripts/upload-oss.sh OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} OSS_ID=${{ secrets.OSS_ID }} OSS_SECRET=${{ secrets.OSS_SECRET }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.filepath }} + ./ci/scripts/upload-oss.sh OSS_ENDPOINT=${{ secrets.OSS_ENDPOINT }} OSS_ID=${{ secrets.OSS_ID }} OSS_SECRET=${{ secrets.OSS_SECRET }} tag=${{ steps.vars.outputs.tag }} filepath=${{ steps.vars.outputs.shafilepath }} shell: bash - - name: upload release artifacts - uses: actions/upload-artifact@v1 - with: - name: ${{ matrix.os }}-release - path: build/cpack_output docker: name: build docker images diff --git a/ci/scripts/upload-oss.sh b/ci/scripts/upload-oss.sh new file mode 100755 index 00000000000..2c88be16748 --- /dev/null +++ b/ci/scripts/upload-oss.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# +# This script upload package to oss. +# +# - OSS_ENDPOINT +# - OSS_ID +# - OSS_SECRET +# - filepath +# - tag +# - nightly +# +# Example: +# +# upload-oss.sh OSS_ENDPOINT=xxx OSS_ID=xxx OSS_SECRET=xxx tag=v0.1.0 filepath=xxx +# upload-oss.sh OSS_ENDPOINT=xxx OSS_ID=xxx OSS_SECRET=xxx filepath=xxx nightly=true + +set -e + +for op in $@; do + eval "$op" +done + +if [[ $nightly != "" ]]; then + OSS_SUBDIR=`date +%Y%m%d` + OSS_URL="oss://nebula-graph/build-deb"/nightly/${OSS_SUBDIR} +else + OSS_SUBDIR=`echo $tag |sed 's/^v//'` + OSS_URL="oss://nebula-graph/build-deb"/${OSS_SUBDIR} +fi + +echo "Uploading oss... " +ossutil64 -e ${OSS_ENDPOINT} -i ${OSS_ID} -k ${OSS_SECRET} -f cp ${filepath} ${OSS_URL}/$(basename ${filepath})