Skip to content

Commit

Permalink
refactor: add 'working-dir' in upload-artifacts action and rename 'co…
Browse files Browse the repository at this point in the history
…ntext' to 'working-dir'
  • Loading branch information
zyy17 committed Aug 9, 2023
1 parent da3fc87 commit 257753e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .github/actions/build-greptime-binary/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }} \
Expand All @@ -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 }}
12 changes: 6 additions & 6 deletions .github/actions/build-linux-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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' }}
Expand All @@ -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
Expand All @@ -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 }}
11 changes: 9 additions & 2 deletions .github/actions/upload-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} && \
Expand All @@ -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 }} && \
Expand All @@ -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' }}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }}
dev-mode: true # Only build the standard greptime binary.
upload-to-s3: false # No need to upload to S3.
context: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}

build-linux-arm64-artifacts:
name: Build linux-arm64 artifacts
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
aws-region: ${{ vars.AWS_RELEASE_BUCKET_REGION }}
dev-mode: true # Only build the standard greptime binary.
upload-to-s3: false # No need to upload to S3.
context: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}

release-images-to-dockerhub:
name: Build and push images to DockerHub
Expand Down

0 comments on commit 257753e

Please sign in to comment.