Skip to content

Commit

Permalink
Merge pull request #789 from vespa-engine/thomasht86/ci-updates
Browse files Browse the repository at this point in the history
CI - VespaCLI: Fix autodist
  • Loading branch information
thomasht86 authored May 29, 2024
2 parents 6f1da7d + c0ab233 commit 6d747d3
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 236 deletions.
179 changes: 179 additions & 0 deletions .github/workflows/vespacli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: vespacli - Check, Update, Test, Create PR, Release

defaults:
run:
working-directory: ./vespacli

on:
workflow_dispatch:
schedule:
# Run at midnight sunday-thursday
- cron: "0 0 * * 1-4"

jobs:
check-and-update:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_output.outputs.version }}

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies and this repo
run: |
python -m pip install --upgrade pip
pip install -e .[build]
- name: Check latest version and set version variable
id: check_latest_version
run: |
version=$(python utils/check_latest_version.py)
echo "Latest version is $version"
# Set the output variable
echo "version=$version" >> $GITHUB_OUTPUT
- name: Update the version (if not NA)
if: ${{ (steps.check_latest_version.outputs.version != 'NA') }}
run: |
# Print evaluation of the condition
echo "Version is not NA, updating version to ${{ steps.check_latest_version.outputs.version }}"
echo "Updating Vespa CLI version to ${{ steps.check_latest_version.outputs.version }}"
python utils/update_version.py --version ${{ steps.check_latest_version.outputs.version }}
- name: Download latest binaries
if: ${{ steps.check_latest_version.outputs.version != 'NA' }}
run: |
python utils/download_binaries.py --version ${{ steps.check_latest_version.outputs.version }}
- name: Upload binaries as artifact
uses: actions/upload-artifact@v4
with:
name: binaries
path: vespacli/vespacli/go-binaries

- name: Set the output variable
id: set_output
if: ${{ steps.check_latest_version.outputs.version != 'NA' }}
run: |
echo "version=${{ steps.check_latest_version.outputs.version }}" >> $GITHUB_OUTPUT
test:
needs: check-and-update
if: ${{ needs.check-and-update.outputs.version != 'NA' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-12, macos-14]
python-version: ["3.10", "3.11"] # Update or modify Python versions as needed
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: binaries
path: vespacli/vespacli/go-binaries

- name: Set permissions on all files in go-binaries
run: |
chmod -R +x vespacli/go-binaries/*
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[build]
- name: Update latest version
run: |
python utils/update_version.py --version ${{ needs.check-and-update.outputs.version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[build]
- name: Verify installation
run: |
vespa version
create-pr:
needs: [check-and-update, test]
outputs:
version: ${{ needs.check-and-update.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies and this repo
run: |
python -m pip install --upgrade pip
pip install -e .[build]
- name: Update latest version
run: |
python utils/update_version.py --version ${{ needs.check-and-update.outputs.version }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update Vespa CLI version to ${{ needs.check-and-update.outputs.version }}"
title: "Update Vespa CLI version to ${{ needs.check-and-update.outputs.version }}"
body: "This PR updates the Vespa CLI version to ${{ needs.check-and-update.outputs.version }}"
branch: "update-vespa-cli-version-${{ needs.check-and-update.outputs.version }}"
base: "master"
labels: "vespacli"

release:
needs: create-pr
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies and this repo
run: |
python -m pip install --upgrade pip
pip install -e .[build]
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: binaries
path: vespacli/vespacli/go-binaries

- name: Set permissions on all files in go-binaries
run: |
chmod -R +x vespacli/go-binaries/*
- name: Update latest version
run: |
python utils/update_version.py --version ${{ needs.create-pr.outputs.version }}
- name: Build
run: |
python -m build
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_VESPACLI }}
run: |
python -m twine upload dist/*
55 changes: 0 additions & 55 deletions .github/workflows/vespacli_check_version.yml

This file was deleted.

81 changes: 0 additions & 81 deletions .github/workflows/vespacli_release_publish.yml

This file was deleted.

68 changes: 0 additions & 68 deletions .github/workflows/vespacli_test.yml

This file was deleted.

5 changes: 0 additions & 5 deletions vespacli/requirements_build.txt

This file was deleted.

Loading

0 comments on commit 6d747d3

Please sign in to comment.