Skip to content

Commit

Permalink
feat: Add GitHub Actions workflow and action for Vespa CLI
Browse files Browse the repository at this point in the history
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
esolitos authored and gitbutler-client committed Aug 8, 2024
1 parent 5b6b7b0 commit 897e6f8
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Test

on: # yamllint disable-line rule:truthy

Check warning on line 4 in .github/workflows/test.yml

View workflow job for this annotation

GitHub Actions / lint

4:5 [comments] too few spaces before comment
push:
branches:
- 1.x
pull_request:
branches:
- 1.x

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
vespa-cli-version: [latest, 8.371.16]

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 .
39 changes: 39 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
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//')

Check failure on line 19 in action.yml

View workflow job for this annotation

GitHub Actions / lint

19:81 [line-length] line too long (140 > 80 characters)
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 }}
RUNNER_OS: ${{ runner.os }}
RUNNER_ARCH: ${{ runner.arch }}
run: |
ARCHIVE_NAME="vespa-cli_${VESPA_CLI_VERSION}_${RUNNER_OS}_${RUNNER_ARCH}"
DOWNLOAD_URL="https://github.com/vespa-engine/vespa/releases/download/v${VESPA_CLI_VERSION}/${ARCHIVE_NAME}.tar.gz"
curl -fsSL "${DOWNLOAD_URL}" | tar -zxf - -C /opt && \
ln -sf /opt/${ARCHIVE_NAME}/bin/vespa /usr/local/bin/
# Verify the installation
vespa version

0 comments on commit 897e6f8

Please sign in to comment.