From afdb7bde8569b9b5879cbae81641b119f3019e4f Mon Sep 17 00:00:00 2001 From: zyy17 Date: Wed, 9 Aug 2023 15:26:37 +0800 Subject: [PATCH] refactor: add 'working-dir' in upload-artifacts action and rename 'context' to 'working-dir' --- .github/actions/build-greptime-binary/action.yml | 7 ++++--- .github/actions/build-linux-artifacts/action.yml | 12 ++++++------ .github/actions/upload-artifacts/action.yml | 11 +++++++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/actions/build-greptime-binary/action.yml b/.github/actions/build-greptime-binary/action.yml index d593de882f09..aecd931f0eae 100644 --- a/.github/actions/build-greptime-binary/action.yml +++ b/.github/actions/build-greptime-binary/action.yml @@ -32,8 +32,8 @@ inputs: description: Upload to S3 required: false default: 'true' - context: - description: Context to build the docker image + working-dir: + description: Working directory to build the artifacts required: false default: . runs: @@ -42,7 +42,7 @@ runs: - name: Build greptime binary shell: bash run: | - cd ${{ inputs.context }} && \ + cd ${{ inputs.working-dir }} && \ make build-greptime-by-buildx \ CARGO_PROFILE=${{ inputs.cargo-profile }} \ FEATURES=${{ inputs.features }} \ @@ -59,3 +59,4 @@ runs: aws-secret-access-key: ${{ inputs.aws-secret-access-key }} aws-region: ${{ inputs.aws-region }} upload-to-s3: ${{ inputs.upload-to-s3 }} + working-dir: ${{ inputs.working-dir }} diff --git a/.github/actions/build-linux-artifacts/action.yml b/.github/actions/build-linux-artifacts/action.yml index 6672211bba62..018ee191534e 100644 --- a/.github/actions/build-linux-artifacts/action.yml +++ b/.github/actions/build-linux-artifacts/action.yml @@ -33,8 +33,8 @@ inputs: description: Upload to S3 required: false default: 'true' - context: - description: Context to build the docker image + working-dir: + description: Working directory to build the artifacts required: false default: . runs: @@ -45,7 +45,7 @@ runs: shell: bash # NOTE: If the BUILD_JOBS > 4, it's always OOM in EC2 instance. run: | - cd ${{ inputs.context }} && \ + cd ${{ inputs.working-dir }} && \ make run-it-in-container BUILD_JOBS=4 - name: Upload sqlness logs @@ -69,7 +69,7 @@ runs: aws-secret-access-key: ${{ inputs.aws-secret-access-key }} aws-region: ${{ inputs.aws-region }} upload-to-s3: ${{ inputs.upload-to-s3 }} - context: ${{ inputs.context }} + working-dir: ${{ inputs.working-dir }} - name: Build greptime without pyo3 if: ${{ inputs.dev-mode == 'false' }} @@ -85,7 +85,7 @@ runs: aws-secret-access-key: ${{ inputs.aws-secret-access-key }} aws-region: ${{ inputs.aws-region }} upload-to-s3: ${{ inputs.upload-to-s3 }} - context: ${{ inputs.context }} + working-dir: ${{ inputs.working-dir }} - name: Build greptime on centos base image uses: ./.github/actions/build-greptime-binary @@ -101,4 +101,4 @@ runs: aws-secret-access-key: ${{ inputs.aws-secret-access-key }} aws-region: ${{ inputs.aws-region }} upload-to-s3: ${{ inputs.upload-to-s3 }} - context: ${{ inputs.context }} + working-dir: ${{ inputs.working-dir }} diff --git a/.github/actions/upload-artifacts/action.yml b/.github/actions/upload-artifacts/action.yml index 2ef402f8d00b..f8a0fe5216fd 100644 --- a/.github/actions/upload-artifacts/action.yml +++ b/.github/actions/upload-artifacts/action.yml @@ -26,10 +26,15 @@ inputs: description: Upload to S3 required: false default: 'true' + working-dir: + description: Working directory to upload the artifacts + required: false + default: . runs: using: composite steps: - name: Create artifacts directory + working-directory: ${{ inputs.working-dir }} shell: bash run: | mkdir -p ${{ inputs.artifacts-dir }} && \ @@ -41,6 +46,7 @@ runs: # greptime-linux-amd64-pyo3-v0.3.0 # └── greptime - name: Compress artifacts and calculate checksum + working-directory: ${{ inputs.working-dir }} shell: bash run: | tar -zcvf ${{ inputs.artifacts-dir }}.tar.gz ${{ inputs.artifacts-dir }} && \ @@ -52,13 +58,13 @@ runs: uses: actions/upload-artifact@v3 with: name: ${{ inputs.artifacts-dir }} - path: ${{ inputs.artifacts-dir }}.tar.gz + path: ${{ inputs.working-dir }}/${{ inputs.artifacts-dir }}.tar.gz - name: Upload checksum uses: actions/upload-artifact@v3 with: name: ${{ inputs.artifacts-dir }}.sha256sum - path: ${{ inputs.artifacts-dir }}.sha256sum + path: ${{ inputs.working-dir }}/${{ inputs.artifacts-dir }}.sha256sum - name: Configure AWS credentials if: ${{ inputs.upload-to-s3 == 'true' }} @@ -70,6 +76,7 @@ runs: - name: Upload artifacts to S3 if: ${{ inputs.upload-to-s3 == 'true' }} + working-directory: ${{ inputs.working-dir }} shell: bash # The bucket layout will be: # releases/greptimedb