-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add GitHub Actions workflow and action for Vespa CLI
Adds a GitHub Actions workflow to test the Vespa CLI installation using the latest and a specific version of the CLI. Also adds a reusable action to install the Vespa CLI on the runner.
- Loading branch information
1 parent
5b6b7b0
commit 60de76f
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- 1.x | ||
pull_request: | ||
branches: | ||
- 1.x | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
vespa-cli-version: [latest, 8.371.16] | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Vespa CLI | ||
uses: ./ | ||
with: | ||
version: ${{ matrix.vespa-cli-version }} | ||
|
||
- name: Verify Vespa CLI | ||
run: vespa version | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Lint YAML files | ||
run: yamllint --format github . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
line-length: disable | ||
truthy: | ||
check-keys: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Setup Vespa CLI on GitHub Actions | ||
|
||
This action sets up Vespa CLI as part of your GitHub Actions workflow. | ||
|
||
## Inputs | ||
|
||
| name | required | type | default | description | | ||
| ------------ | --- | ------ | --------------- | ----------- | | ||
| version | yes | string | `latest` | The version of Vespa CLI to install. | | ||
|
||
## Example usage | ||
|
||
Workflow: | ||
|
||
```yml | ||
--- | ||
name: CI | ||
on: | ||
push: ~ | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Vespa CLI | ||
uses: vespa-engine/setup-vespa-cli@v1 | ||
|
||
- name: Do something with the vespa CLI | ||
run: | | ||
vespa auth login | ||
... | ||
vespa deploy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
name: "Setup Vespa CLI" | ||
description: "Installs the Vespa CLI tool on the runner." | ||
|
||
inputs: | ||
# The version of the Vespa CLI to install. | ||
version: | ||
description: "The version of the Vespa CLI to install." | ||
default: "latest" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Select CLI version | ||
shell: bash | ||
id: vespa-cli-version | ||
run: | | ||
if [ "${{ inputs.version }}" == "latest" ]; then | ||
VESPA_CLI_VERSION=$(curl -fsSL https://api.github.com/repos/vespa-engine/vespa/releases/latest | jq -r '.tag_name' | sed 's/^v//') | ||
else | ||
VESPA_CLI_VERSION="${{ inputs.version }}" | ||
fi | ||
echo "version=${VESPA_CLI_VERSION}" >> "$GITHUB_OUTPUT" | ||
- name: Install Vespa CLI | ||
shell: bash | ||
env: | ||
VESPA_CLI_VERSION: ${{ steps.vespa-cli-version.outputs.version }} | ||
ARCH: ${{ startswith(runner.arch, 'ARM') && 'arm64' || 'amd64' }} | ||
run: | | ||
ARCHIVE_NAME="$(echo "vespa-cli_${VESPA_CLI_VERSION}_linux_${ARCH}" | tr '[:upper:]' '[:lower:]')" | ||
DOWNLOAD_URL="https://github.com/vespa-engine/vespa/releases/download/v${VESPA_CLI_VERSION}/${ARCHIVE_NAME}.tar.gz" | ||
echo "Downloading: ${DOWNLOAD_URL}" | ||
curl -fsSL "${DOWNLOAD_URL}" | tar -zxf - -C /opt | ||
chmod +x /opt/${ARCHIVE_NAME}/bin/* | ||
ln -sf /opt/${ARCHIVE_NAME}/bin/vespa /usr/local/bin/ | ||
# Verify the installation | ||
vespa version |