Skip to content

Commit

Permalink
perf: use setup-binary action to improve binary install performance (#…
Browse files Browse the repository at this point in the history
…129)

fix: #124
  • Loading branch information
sqin2019 authored Sep 19, 2023
1 parent e630e9e commit 5755d9f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ on:
type: 'string'
required: true
aod_cli_version:
description: 'The version of AOD CLI.'
description: 'The version of AOD CLI, without the "v" prefix, e.g. "0.1.2".'
type: 'string'
default: 'latest'
required: false
required: true
go_version:
description: 'The version of Golang.'
type: 'string'
Expand Down Expand Up @@ -109,8 +108,13 @@ jobs:
- name: 'Set up Cloud SDK for tool request'
if: '${{ hashFiles(''tool.yaml'') != '''' }}'
uses: 'google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b' # ratchet:google-github-actions/setup-gcloud@v1
- name: 'Install AOD CLI'
run: 'go install github.com/abcxyz/access-on-demand/cmd/aod@${{ inputs.aod_cli_version }}'
- name: 'Setup AOD'
uses: 'abcxyz/pkg/.github/actions/setup-binary@def8ffd12d32b2e8656152b1eea46017dc8f8eaa' # ratchet:abcxyz/pkg/.github/actions/setup-binary@v0.7.0
with:
download_url: 'https://github.com/abcxyz/access-on-demand/releases/download/v${{ inputs.aod_cli_version }}/aod_${{ inputs.aod_cli_version }}_linux_amd64.tar.gz'
install_path: '${{ runner.temp }}/.aod'
cache_key: '${{ runner.os }}_${{ runner.arch }}_aod_${{ inputs.aod_cli_version }}'
add_to_path: true
- name: 'Handle tool cleanup'
if: '${{ hashFiles(''tool.yaml'') != '''' }}'
id: 'cleanup_tool'
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/handle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ on:
type: 'string'
required: true
aod_cli_version:
description: 'The version of AOD CLI.'
description: 'The version of AOD CLI, without the "v" prefix, e.g. "0.1.2".'
type: 'string'
default: 'latest'
required: false
required: true
go_version:
description: 'The version of Golang.'
type: 'string'
Expand Down Expand Up @@ -105,9 +104,14 @@ jobs:
- name: 'Set up Cloud SDK'
if: '${{ hashFiles(''tool.yaml'') != '''' }}'
uses: 'google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b' # ratchet:google-github-actions/setup-gcloud@v1
- name: 'Install AOD CLI'
- name: 'Setup AOD'
if: '${{ hashFiles(''iam.yaml'', ''tool.yaml'') != '''' }}'
run: 'go install github.com/abcxyz/access-on-demand/cmd/aod@${{ inputs.aod_cli_version }}'
uses: 'abcxyz/pkg/.github/actions/setup-binary@def8ffd12d32b2e8656152b1eea46017dc8f8eaa' # ratchet:abcxyz/pkg/.github/actions/setup-binary@v0.7.0
with:
download_url: 'https://github.com/abcxyz/access-on-demand/releases/download/v${{ inputs.aod_cli_version }}/aod_${{ inputs.aod_cli_version }}_linux_amd64.tar.gz'
install_path: '${{ runner.temp }}/.aod'
cache_key: '${{ runner.os }}_${{ runner.arch }}_aod_${{ inputs.aod_cli_version }}'
add_to_path: true
# Duration labels need to be prefixed with "duration-", an example is "duration-2h".
- name: 'Get Duration From Label'
if: '${{ hashFiles(''iam.yaml'') != '''' }}'
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ on:
workflow_call:
inputs:
aod_cli_version:
description: 'The version of AOD CLI.'
description: 'The version of AOD CLI, without the "v" prefix, e.g. "0.1.2".'
type: 'string'
default: 'latest'
required: false
required: true
go_version:
description: 'The version of Golang.'
type: 'string'
Expand All @@ -48,8 +47,13 @@ jobs:
uses: 'actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568' # ratchet:actions/setup-go@v3
with:
go-version: '${{ inputs.go_version }}'
- name: 'Install AOD CLI'
run: 'go install github.com/abcxyz/access-on-demand/cmd/aod@${{ inputs.aod_cli_version }}'
- name: 'Setup AOD'
uses: 'abcxyz/pkg/.github/actions/setup-binary@def8ffd12d32b2e8656152b1eea46017dc8f8eaa' # ratchet:abcxyz/pkg/.github/actions/setup-binary@v0.7.0
with:
download_url: 'https://github.com/abcxyz/access-on-demand/releases/download/v${{ inputs.aod_cli_version }}/aod_${{ inputs.aod_cli_version }}_linux_amd64.tar.gz'
install_path: '${{ runner.temp }}/.aod'
cache_key: '${{ runner.os }}_${{ runner.arch }}_aod_${{ inputs.aod_cli_version }}'
add_to_path: true
# IAM request will not be validated when iam.yaml file does not exist,
# tool request will be not validated when tool.yaml file does not exist.
- name: 'Validate AOD Request'
Expand Down
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ as a tool proxy.
## Installation

```sh
go install github.com/abcxyz/access-on-demand/cmd/aod
go install github.com/abcxyz/access-on-demand/cmd/aod@latest
```

## Usage
Expand Down

0 comments on commit 5755d9f

Please sign in to comment.