Skip to content

Commit

Permalink
feat: migrate several "verify-guides" workflow to Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos authored and gitbutler-client committed Aug 13, 2024
1 parent 99c0f47 commit 27280d6
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/actions/free-space/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Free disk space
description: Frees some disk space on the runner.

runs:
using: "composite"
steps:
- name: Remove Android library (~14GiB)
shell: bash
run: |
sudo rm -rf /usr/local/lib/android|| true
- name: Remove .Net runtime (~2.7GiB)
shell: bash
run: |
sudo rm -rf /usr/share/dotnet|| true
- name: Remove misc large packages (~5.3GiB)
shell: bash
run: |
sudo apt-get remove -yq --fix-missing --autoremove '^aspnetcore-.*' || true
sudo apt-get remove -yq --fix-missing --autoremove '^dotnet-.*' || true
sudo apt-get remove -yq --fix-missing --autoremove '^llvm-.*' || true
sudo apt-get remove -yq --fix-missing --autoremove '^mongodb-.*' || true
sudo apt-get remove -yq --fix-missing --autoremove '^google-cloud-*' || true
sudo apt-get remove -yq --fix-missing --autoremove php-common php-pear|| true
sudo apt-get remove -yq --fix-missing --autoremove mysql-common || true
sudo apt-get remove -yq --fix-missing --autoremove azure-cli powershell mono-devel libgl1-mesa-dri|| true
sudo apt-get remove -yq --fix-missing --autoremove google-chrome-stable firefox microsoft-edge-stable|| true
sudo apt-get remove -yq --fix-missing --autoremove snapd|| true
sudo apt-get autoremove -yq|| true
sudo apt-get clean|| true
- name: Remove Tool Cache (~5.9GiB)
shell: bash
run: |
sudo rm -rf "$AGENT_TOOLSDIRECTORY"|| true
26 changes: 26 additions & 0 deletions .github/actions/install-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Setup Vespa CLI and dependencies"
description: "Install Vespa CLI and dependencies"

runs:
using: "composite"
steps:
# - name: Setup Ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: 3.1
# bundler-cache: true

# - uses: actions/setup-java@v4
# with:
# distribution: "temurin"
# java-version: "17"

- name: Install python dependencies
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -qqq -r test/requirements.txt --user
python3 -m pip install -qqq pytest nbmake --user
- name: Install Vespa CLI
uses: vespa-engine/setup-vespa-cli-action@v1
20 changes: 20 additions & 0 deletions .github/workflows/verify-guides-billion-vector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Verify Giudes (billion scale vector search)

on:
workflow_dispatch: # Allow manual triggering of this workflow.

push:
branches: ["master"]
paths:
- "billion-scale-vector-search/"

pull_request:
branches: ["master"]
paths:
- "billion-scale-vector-search/"

jobs:
main:
uses: ./.github/workflows/verify-guides.yml
with:
test-file: "billion-scale-vector-search/README.md"
24 changes: 24 additions & 0 deletions .github/workflows/verify-guides-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Verify Giudes (Main)

on:
workflow_dispatch: # Allow manual triggering of this workflow.

push:
branches: ["master"]
paths-ignore:
- "billion-scale-vector-search/"
- "billion-scale-image-search/"
- "examples/model-deployment/"

pull_request:
branches: ["master"]
paths-ignore:
- "billion-scale-vector-search/"
- "billion-scale-image-search/"
- "examples/model-deployment/"

jobs:
main:
uses: ./.github/workflows/verify-guides.yml
with:
test-config-path: "test/_test_config.yml"
51 changes: 51 additions & 0 deletions .github/workflows/verify-guides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Verify Giudes

on:
workflow_call:
inputs:
test-config-path:
description: |
The path to the test configuration file, relative to the repository root.
::warning:: This is mutually exclusive with `test-file`.
Example: `test/_test_config.yml`
type: string
required: false
test-file:
description: |
The path to the test file, relative to the repository root. This is used to run tests for a specific guide.
::warning:: This is mutually exclusive with `test-config-path` and will take precedence over it.
Example: `billion-scale-vector-search/README.md`
type: string
required: false

defaults:
run:
# Specify to ensure "pipefail and errexit" are set.
# Ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell
shell: bash

jobs:
test:
runs-on: ubuntu-latest
env:
LANG: "C.UTF-8"
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/free-space

- uses: ./.github/actions/install-deps

- name: run-tests (config)
if: ${{ inputs.test-config-path && !inputs.test-file }}
run: |
./test/test.py -w $GITHUB_WORKSPACE -c ${{ inputs.test-config-path }}
- name: run-tests (file)
if: ${{ inputs.test-file && !inputs.test-config-path }}
run: |
./test/test.py -w $GITHUB_WORKSPACE ${{ inputs.test-file }}

0 comments on commit 27280d6

Please sign in to comment.