From e412888e68ebae00469e3f050a2516ae8433b0a1 Mon Sep 17 00:00:00 2001 From: laura-ding <48548375+laura-ding@users.noreply.github.com> Date: Wed, 25 Mar 2020 20:54:04 +0800 Subject: [PATCH 1/4] upload oss --- .github/workflows/package.yaml | 7 +++++++ .github/workflows/release.yaml | 2 ++ ci/scripts/upload-oss.sh | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100755 ci/scripts/upload-oss.sh diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 406a9398204..34a996d680f 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -32,9 +32,16 @@ jobs: id: version run: | [[ "${{ github.event_name }}" == "push" ]] && \ + cd $CPACK_OUTPUT_DIR \ + filename=$(find . -type f \( -iname \*.deb -o -iname \*.rpm \) -exec basename {} \;) \ + echo "::set-output name=filepath::$CPACK_OUTPUT_DIR/$filename" \ echo "::set-output name=version::$(cut -d/ -f3 <<< ${{ github.ref }})" || \ echo "::set-output name=version::nightly" shell: bash + - name: upload oss + 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: name: ${{ matrix.os }}-${{ steps.version.outputs.version }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7fd4716dc64..231f5adae00 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,6 +40,8 @@ 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 diff --git a/ci/scripts/upload-oss.sh b/ci/scripts/upload-oss.sh new file mode 100755 index 00000000000..a16f967e7f0 --- /dev/null +++ b/ci/scripts/upload-oss.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# This script upload package to oss. +# +# - OSS_ENDPOINT +# - OSS_ID +# - OSS_SECRET +# - release +# - tag +# - filepath +# - 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 + +wget -c http://gosspublic.alicdn.com/ossutil/1.6.10/ossutil64 +chmod +x ossutil64 + +echo "Uploading oss... " +ossutil64 -e ${OSS_ENDPOINT} -i ${OSS_ID} -k ${OSS_SECRET} -f cp ${filepath} ${OSS_URL}/$(basename ${filepath}) From 73042e3ca37cc3cf6392a396876873982007861f Mon Sep 17 00:00:00 2001 From: laura-ding <48548375+laura-ding@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:28:57 +0800 Subject: [PATCH 2/4] update --- .github/workflows/build.yaml | 5 +++++ .github/workflows/package.yaml | 14 ++++++++------ .github/workflows/release.yaml | 4 ++-- ci/scripts/upload-oss.sh | 3 --- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d0d78148040..72c0d0587e4 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 34a996d680f..66cbf273e62 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -30,17 +30,19 @@ jobs: shell: bash - name: Compute version id: version + env: + CPACK_OUTPUT_DIR: build/cpack_output run: | - [[ "${{ github.event_name }}" == "push" ]] && \ - cd $CPACK_OUTPUT_DIR \ - filename=$(find . -type f \( -iname \*.deb -o -iname \*.rpm \) -exec basename {} \;) \ - echo "::set-output name=filepath::$CPACK_OUTPUT_DIR/$filename" \ + [[ "${{ github.event_name }}" == "push" ]] && \ + ( cd $CPACK_OUTPUT_DIR && \ + filename=$(find . -type f \( -iname \*.deb -o -iname \*.rpm \) -exec basename {} \;) + echo "::set-output name=filepath::$CPACK_OUTPUT_DIR/$filename" echo "::set-output name=version::$(cut -d/ -f3 <<< ${{ github.ref }})" || \ - echo "::set-output name=version::nightly" + echo "::set-output name=version::nightly") shell: bash - name: upload oss 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 + ./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 231f5adae00..d3181708e07 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,8 +40,8 @@ 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 } + ./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 diff --git a/ci/scripts/upload-oss.sh b/ci/scripts/upload-oss.sh index a16f967e7f0..6831f61dc27 100755 --- a/ci/scripts/upload-oss.sh +++ b/ci/scripts/upload-oss.sh @@ -29,8 +29,5 @@ else OSS_URL="oss://nebula-graph/build-deb"/${OSS_SUBDIR} fi -wget -c http://gosspublic.alicdn.com/ossutil/1.6.10/ossutil64 -chmod +x ossutil64 - echo "Uploading oss... " ossutil64 -e ${OSS_ENDPOINT} -i ${OSS_ID} -k ${OSS_SECRET} -f cp ${filepath} ${OSS_URL}/$(basename ${filepath}) From 396de057bdd4500e7a3de321412403125f772182 Mon Sep 17 00:00:00 2001 From: laura-ding <48548375+laura-ding@users.noreply.github.com> Date: Tue, 31 Mar 2020 10:15:43 +0800 Subject: [PATCH 3/4] Remove redundant --- ci/scripts/upload-oss.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/scripts/upload-oss.sh b/ci/scripts/upload-oss.sh index 6831f61dc27..2c88be16748 100755 --- a/ci/scripts/upload-oss.sh +++ b/ci/scripts/upload-oss.sh @@ -5,9 +5,8 @@ # - OSS_ENDPOINT # - OSS_ID # - OSS_SECRET -# - release -# - tag # - filepath +# - tag # - nightly # # Example: From 99a85181327200b74b156e51cc5f9cd414f45a52 Mon Sep 17 00:00:00 2001 From: laura-ding <48548375+laura-ding@users.noreply.github.com> Date: Tue, 31 Mar 2020 14:19:11 +0800 Subject: [PATCH 4/4] address @yixinlu's comment --- .github/workflows/package.yaml | 12 +++++++----- .github/workflows/release.yaml | 5 ----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 66cbf273e62..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: @@ -33,14 +34,15 @@ jobs: env: CPACK_OUTPUT_DIR: build/cpack_output run: | - [[ "${{ github.event_name }}" == "push" ]] && \ - ( cd $CPACK_OUTPUT_DIR && \ - filename=$(find . -type f \( -iname \*.deb -o -iname \*.rpm \) -exec basename {} \;) - echo "::set-output name=filepath::$CPACK_OUTPUT_DIR/$filename" + [[ "${{ 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 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d3181708e07..c7193469c01 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -43,11 +43,6 @@ jobs: ./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