Skip to content

Commit

Permalink
update zeitgeist and add option to install local or remote releases
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Apr 30, 2024
1 parent e6fb133 commit 87d0d06
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 14 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/test-setup-zeitgeist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Install zeitgeist
uses: ./setup-zeitgeist
- name: Check install!
- name: Check version
run: zeitgeist version
- name: Check root directory
run: |
Expand All @@ -72,8 +72,8 @@ jobs:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
go_version:
- '1.20'
- '1.21'
- '1.22'
name: Try to install zeitgeist with go ${{ matrix.go_version }}
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
Expand All @@ -85,7 +85,8 @@ jobs:
uses: ./setup-zeitgeist
with:
zeitgeist-release: 'main'
- name: Check install!
remote-version: 'false'
- name: Check version!
run: zeitgeist version

test_zeitgeist_action_custom_dir_root:
Expand All @@ -104,7 +105,7 @@ jobs:
with:
install-dir: /usr/bin
use-sudo: true
- name: Check install!
- name: Check version
run: zeitgeist version
- name: Check install dir!
run: |
Expand All @@ -130,7 +131,7 @@ jobs:
uses: ./setup-zeitgeist
with:
install-dir: "$HOME/.zeitgeisttest"
- name: Check install!
- name: Check version
run: zeitgeist version
- name: Check install dir!
run: |
Expand All @@ -141,6 +142,33 @@ jobs:
[[ -z $(git diff --stat) ]]
shell: bash

test_zeitgeist_local:
needs: changes
if: ${{ needs.changes.outputs.zeitgeist == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
permissions: {}
name: Install zeitgeist local
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Install zeitgeist
uses: ./setup-zeitgeist
with:
remote-version: 'false'
- name: Check version
run: zeitgeist version
- name: Check root directory
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'should be clean'
exit 1
else
exit 0
fi
shell: bash

test_zeitgeist_action_wrong:
runs-on: ${{ matrix.os }}
needs: changes
Expand Down
1 change: 1 addition & 0 deletions setup-zeitgeist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ The following optional inputs:
| Input | Description |
| --- | --- |
| `zeitgeist-release` | `zeitgeist` version to use instead of the default. |
| `remote-version` | install `zeitgeist` that can check depencies from upstream repositories/registries. If false will install the local version only that only check local dependencies. |
| `install-dir` | directory to place the `zeitgeist` binary into instead of the default (`$HOME/.zeitgeist`). |
| `use-sudo` | set to `true` if `install-dir` location requires sudo privs. Defaults to false. |
27 changes: 18 additions & 9 deletions setup-zeitgeist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ inputs:
zeitgeist-release:
description: 'zeitgeist release version to be installed'
required: false
default: '0.4.3'
default: '0.5.3'
remote-version:
description: 'install zeitgeist that can check depencies from upstream repositories/registries. If false will install the local version only that only check local dependencies'
required: false
default: 'true'
install-dir:
description: 'Where to install the zeitgeist binary'
required: false
Expand All @@ -41,7 +45,7 @@ runs:
use-sudo: ${{ inputs.use-sudo }}
- shell: bash
run: |
#!/bin/bash
#!/usr/bin/env bash
# zeitgeist install script
shopt -s expand_aliases
if [ -z "$NO_COLOR" ]; then
Expand All @@ -55,7 +59,12 @@ runs:
mkdir -p ${{ inputs.install-dir }}
if [[ ${{ inputs.zeitgeist-release }} == "main" ]]; then
export ZEITGIEST_REMOTE=
if [[ ${{ inputs.remote-version }} == "true" ]]; then
export ZEITGIEST_REMOTE=-remote
fi
if [[ ${{ inputs.zeitgeist-release }} == "main" && ${{ inputs.remote-version }} == "false" ]]; then
log_info "installing zeitgeist via 'go install' from its main version"
GOBIN=$(go env GOPATH)/bin
go install sigs.k8s.io/zeitgeist@master
Expand All @@ -71,15 +80,15 @@ runs:
Linux)
case ${{ runner.arch }} in
X64)
desired_zeitgeist_filename='zeitgeist-amd64-linux'
desired_zeitgeist_filename="zeitgeist${ZEITGIEST_REMOTE}-amd64-linux"
;;
ARM)
desired_zeitgeist_filename='zeitgeist-arm-linux'
desired_zeitgeist_filename="zeitgeist${ZEITGIEST_REMOTE}-arm-linux"
;;
ARM64)
desired_zeitgeist_filename='zeitgeist-arm64-linux'
desired_zeitgeist_filename="zeitgeist${ZEITGIEST_REMOTE}-arm64-linux"
;;
*)
Expand All @@ -92,11 +101,11 @@ runs:
macOS)
case ${{ runner.arch }} in
X64)
desired_zeitgeist_filename='zeitgeist-amd64-darwin'
desired_zeitgeist_filename="zeitgeist${ZEITGIEST_REMOTE}-amd64-darwin"
;;
ARM64)
desired_zeitgeist_filename='zeitgeist-arm64-darwin'
desired_zeitgeist_filename="zeitgeist${ZEITGIEST_REMOTE}-arm64-darwin"
;;
*)
Expand All @@ -109,7 +118,7 @@ runs:
Windows)
case ${{ runner.arch }} in
X64)
desired_zeitgeist_filename='zeitgeist-amd64-windows.exe'
desired_zeitgeist_filename="zeitgeist${ZEITGIEST_REMOTE}-amd64-windows.exe"
zeitgeist_executable_name=zeitgeist.exe
;;
*)
Expand Down

0 comments on commit 87d0d06

Please sign in to comment.