2022-12-31 08:58:08 +03:00
|
|
|
# This workflow tests the various sq install mechanisms.
|
2022-12-31 08:43:51 +03:00
|
|
|
name: Test Install
|
2022-12-31 07:54:30 +03:00
|
|
|
on:
|
|
|
|
workflow_call:
|
2022-12-31 07:54:58 +03:00
|
|
|
|
2022-12-31 07:54:30 +03:00
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2022-12-31 09:18:40 +03:00
|
|
|
macos-brew:
|
2022-12-31 07:54:30 +03:00
|
|
|
runs-on: macos-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
|
|
- name: Set up Homebrew
|
|
|
|
uses: Homebrew/actions/setup-homebrew@master
|
|
|
|
|
|
|
|
- name: Test brew
|
|
|
|
shell: bash
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
|
|
|
brew install neilotoole/sq/sq
|
2023-11-19 03:05:48 +03:00
|
|
|
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
|
2022-12-31 07:54:30 +03:00
|
|
|
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-31 09:18:40 +03:00
|
|
|
macos-install-sh:
|
2022-12-31 07:54:30 +03:00
|
|
|
runs-on: macos-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
|
|
- name: Set up Homebrew
|
|
|
|
uses: Homebrew/actions/setup-homebrew@master
|
|
|
|
|
|
|
|
- name: Test install.sh
|
|
|
|
shell: bash
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
|
|
|
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
|
2023-11-19 03:05:48 +03:00
|
|
|
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
|
2022-12-31 07:54:30 +03:00
|
|
|
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-31 09:20:40 +03:00
|
|
|
linux-other:
|
2022-12-31 07:54:30 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
container:
|
|
|
|
- "ubuntu:latest"
|
|
|
|
- "fedora:latest"
|
|
|
|
- "rockylinux:9"
|
|
|
|
# - "opensuse/leap:latest"
|
|
|
|
|
|
|
|
container:
|
|
|
|
image: ${{ matrix.container }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Test install.sh
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set pipefail
|
|
|
|
set +e
|
2023-06-22 20:34:35 +03:00
|
|
|
|
2022-12-31 07:54:30 +03:00
|
|
|
# Some images don't have curl installed
|
|
|
|
if ! command -v curl &> /dev/null ; then
|
|
|
|
if command -v apt &> /dev/null; then
|
|
|
|
apt update && apt install -y curl
|
|
|
|
fi
|
|
|
|
fi
|
2023-06-22 20:34:35 +03:00
|
|
|
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e
|
2023-06-22 20:34:35 +03:00
|
|
|
|
2022-12-31 07:54:30 +03:00
|
|
|
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
|
2023-11-19 03:05:48 +03:00
|
|
|
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
|
2022-12-31 07:54:30 +03:00
|
|
|
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-31 09:18:40 +03:00
|
|
|
alpine:
|
2022-12-31 07:54:30 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
container: alpine:latest
|
|
|
|
steps:
|
|
|
|
- name: Test install
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
|
|
|
apk add curl
|
|
|
|
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
|
2023-11-19 03:05:48 +03:00
|
|
|
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
|
2022-12-31 07:54:30 +03:00
|
|
|
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-31 09:18:40 +03:00
|
|
|
archlinux-pacman:
|
2022-12-31 07:54:30 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
container: archlinux:latest
|
|
|
|
steps:
|
|
|
|
- name: Create non-root user
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
|
|
|
|
|
|
|
pacman -Syu --noconfirm
|
|
|
|
pacman -S --needed --noconfirm sudo base-devel
|
|
|
|
|
|
|
|
uname="moi"
|
|
|
|
useradd $uname
|
|
|
|
passwd -d $uname
|
|
|
|
printf '%s ALL=(ALL) ALL\n' $uname | tee -a /etc/sudoers
|
|
|
|
mkdir -p /home/$uname
|
|
|
|
chown -R "$uname:$uname" /home/$uname
|
|
|
|
|
|
|
|
- name: Test install (pacman)
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
2023-06-22 20:34:35 +03:00
|
|
|
|
2022-12-31 07:54:30 +03:00
|
|
|
# Run as non-root user
|
2023-06-22 20:34:35 +03:00
|
|
|
# sudo -u moi
|
|
|
|
|
2022-12-31 07:54:30 +03:00
|
|
|
# Should be installed via pacman
|
|
|
|
sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
|
2023-11-19 03:05:48 +03:00
|
|
|
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
|
2022-12-31 07:54:30 +03:00
|
|
|
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-31 09:18:40 +03:00
|
|
|
archlinux-yay:
|
2022-12-31 07:54:30 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
container: archlinux:latest
|
|
|
|
steps:
|
|
|
|
- name: Create non-root user
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
|
|
|
|
|
|
|
pacman -Syu --noconfirm
|
|
|
|
pacman -S --needed --noconfirm sudo base-devel
|
|
|
|
|
|
|
|
uname="moi"
|
|
|
|
useradd $uname
|
|
|
|
passwd -d $uname
|
|
|
|
printf '%s ALL=(ALL) ALL\n' $uname | tee -a /etc/sudoers
|
|
|
|
mkdir -p /home/$uname
|
|
|
|
chown -R "$uname:$uname" /home/$uname
|
|
|
|
|
|
|
|
- name: Install yay
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
|
|
|
cd /tmp
|
|
|
|
curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/yay-bin.tar.gz
|
|
|
|
tar -xf yay-bin.tar.gz
|
|
|
|
chmod -R 777 yay-bin
|
|
|
|
cd yay-bin
|
|
|
|
sudo -u moi makepkg -sri --noconfirm
|
|
|
|
|
|
|
|
- name: Test install (yay)
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
2023-06-22 20:34:35 +03:00
|
|
|
|
2022-12-31 07:54:30 +03:00
|
|
|
# Should be installed via yay
|
|
|
|
sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
|
2023-11-19 03:05:48 +03:00
|
|
|
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
|
2022-12-31 07:54:30 +03:00
|
|
|
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-31 09:18:40 +03:00
|
|
|
ubuntu-brew:
|
2022-12-31 07:54:30 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
|
|
- name: Set up Homebrew
|
|
|
|
id: set-up-homebrew
|
|
|
|
uses: Homebrew/actions/setup-homebrew@master
|
|
|
|
|
|
|
|
- name: Test install via brew
|
|
|
|
shell: bash
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 07:54:30 +03:00
|
|
|
set -e pipefail
|
|
|
|
brew install neilotoole/sq/sq
|
2023-11-19 03:05:48 +03:00
|
|
|
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
|
2022-12-31 07:54:30 +03:00
|
|
|
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-12-31 08:42:53 +03:00
|
|
|
|
2023-09-25 02:27:42 +03:00
|
|
|
void-linux:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
container: ghcr.io/void-linux/void-glibc:latest
|
|
|
|
steps:
|
|
|
|
- name: Test install
|
|
|
|
run: |-
|
|
|
|
set -e
|
|
|
|
(xbps-install -Syu || true) && xbps-install -yu xbps curl
|
|
|
|
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
|
2023-11-19 04:02:50 +03:00
|
|
|
if [ "$(sq version | awk '{print $1}')" != "sq" ]; then
|
2023-09-25 02:27:42 +03:00
|
|
|
# NOTE: The Void package release is a manual process.
|
|
|
|
# Thus, the released version will not match this particular
|
|
|
|
# workflow release. We'll just do a simple test here.
|
|
|
|
echo "FAIL: sq install not working for some reason"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-12-31 09:18:40 +03:00
|
|
|
windows-scoop:
|
2022-12-31 08:42:53 +03:00
|
|
|
runs-on: windows-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
|
|
- name: Test install (scoop)
|
2023-11-19 03:05:48 +03:00
|
|
|
run: |
|
2022-12-31 08:42:53 +03:00
|
|
|
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
|
|
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
|
|
|
|
|
|
|
|
scoop bucket add sq https://github.com/neilotoole/sq
|
|
|
|
scoop install sq
|
2023-06-22 20:34:35 +03:00
|
|
|
|
2022-12-31 08:42:53 +03:00
|
|
|
$gotVersion = sq version
|
2023-06-22 20:34:35 +03:00
|
|
|
echo "-------- sq version --------"
|
2022-12-31 08:42:53 +03:00
|
|
|
echo $gotVersion
|
2023-06-22 20:34:35 +03:00
|
|
|
echo "----------------------------"
|
|
|
|
|
2022-12-31 08:42:53 +03:00
|
|
|
if ($gotVersion -ne "sq ${{github.ref_name}}") {
|
|
|
|
echo "Wanted: sq ${{github.ref_name}}"
|
|
|
|
echo "Actual: $gotVersion"
|
|
|
|
echo "Incorrect version number"
|
|
|
|
exit 1
|
|
|
|
}
|