Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports arm64 by actions.yml #693

Merged
merged 4 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ on:

jobs:
install:
strategy:
matrix:
runner:
- ubuntu-latest
name: test action
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: kayac/ecspresso@v0
Expand Down Expand Up @@ -56,3 +60,28 @@ jobs:
version: v2.0.4
- run: |
ecspresso version 2>&1 | fgrep v2.0.4

install_on_arm:
strategy:
matrix:
runner:
- buildjet-2vcpu-ubuntu-2204-arm
Copy link
Contributor Author

@fujiwara fujiwara Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, use BuildJet for arm runners support testing.
Replace it with GitHub's hosted arm runner later.

name: test action
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: kayac/ecspresso@v2-action-testing
with:
version: latest
- run: |
ecspresso version 2>&1 | fgrep v2.
- uses: kayac/ecspresso@v2-action-testing
with:
version: v2.0.4
- run: |
ecspresso version 2>&1 | fgrep v2.0.4
- uses: kayac/ecspresso@v2-action-testing
with:
version-file: tests/.ecspresso-version
- run: |
ecspresso version 2>&1 | fgrep v2.0.0
19 changes: 17 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,34 @@ runs:
github_token: ${{ inputs.github-token }}
run: |
set -e
ARCH=$(uname -m)
if [ "${ARCH}" = "x86_64" ]; then
GOARCH="amd64"
elif [ "${ARCH}" = "aarch64" ]; then
GOARCH="arm64"
else
echo "Unsupported architecture: ${ARCH}"
exit 1
fi

VERSION="${{ inputs.version }}"
if [ -n "${{ inputs.version-file }}" ]; then
VERSION="v$(cat ${{ inputs.version-file }})"
fi

echo "VERSION=${VERSION} GOARCH=${GOARCH}"

api_request_args=("-sS")
if [[ -n "$github_token" ]]; then
api_request_args=("${api_request_args[@]}" -H "authorization: token $github_token")
fi
if [ "${VERSION}" = "latest" ]; then
DOWNLOAD_URL=$(curl "${api_request_args[@]}" https://api.github.com/repos/kayac/ecspresso/releases | jq -r '[.[]|select(.tag_name > "v2.0")|select(.prerelease==false)][0].assets[].browser_download_url|select(match("linux.amd64."))')
DOWNLOAD_URL=$(curl "${api_request_args[@]}" https://api.github.com/repos/kayac/ecspresso/releases \
| jq --arg matcher "linux.${GOARCH}." -r '[.[]|select(.tag_name > "v2.0")|select(.prerelease==false)][0].assets[].browser_download_url|select(match($matcher))')
else
DOWNLOAD_URL=https://github.com/kayac/ecspresso/releases/download/${VERSION}/ecspresso_${VERSION:1}_linux_amd64.tar.gz
DOWNLOAD_URL=https://github.com/kayac/ecspresso/releases/download/${VERSION}/ecspresso_${VERSION:1}_linux_${GOARCH}.tar.gz
fi
echo "DOWNLOAD_URL=${DOWNLOAD_URL}"
mkdir -p ${RUNNER_TOOL_CACHE}/ecspresso
cd /tmp
curl -sfLO ${DOWNLOAD_URL}
Expand Down
Loading