2023-09-08 03:15:47 +02:00
|
|
|
name: Self-Hosting Docker Compose Tests
|
2022-11-06 07:34:57 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 06:23:22 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-06 07:34:57 +01:00
|
|
|
- name: Set up Go
|
2024-02-11 20:54:27 +01:00
|
|
|
uses: actions/setup-go@v4
|
2022-11-06 07:34:57 +01:00
|
|
|
with:
|
2024-08-25 21:24:19 +02:00
|
|
|
go-version: 1.23
|
2023-09-08 03:51:13 +02:00
|
|
|
- name: Docker Compose setup
|
2022-11-06 07:34:57 +01:00
|
|
|
run: |
|
2023-09-08 03:15:47 +02:00
|
|
|
set -euo pipefail
|
2022-11-06 07:34:57 +01:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y zsh fish
|
|
|
|
curl -fsSL https://get.docker.com | sudo sh
|
2023-09-08 03:51:13 +02:00
|
|
|
sudo chmod 0755 -R /usr/share/zsh/ # Work around a weird bug where zsh on ubuntu actions gives that diretory 0777 which makes zsh refuse to start
|
2022-11-06 07:34:57 +01:00
|
|
|
sudo hostname ghaction-runner-hostname # Set a consistent hostname so we can run tests that depend on it
|
|
|
|
docker compose -f backend/server/docker-compose.yml build
|
2022-11-06 08:17:52 +01:00
|
|
|
docker compose -f backend/server/docker-compose.yml up -d
|
2022-11-06 07:34:57 +01:00
|
|
|
export HISHTORY_SERVER=http://localhost
|
|
|
|
go build
|
|
|
|
./hishtory install
|
2023-09-08 03:51:13 +02:00
|
|
|
- name: Docker Compose test
|
2023-09-08 07:45:24 +02:00
|
|
|
shell: bash -il {0}
|
2023-09-08 03:51:13 +02:00
|
|
|
run: |
|
2023-09-08 07:45:24 +02:00
|
|
|
set -eo pipefail
|
2023-09-08 03:51:13 +02:00
|
|
|
export HISHTORY_SERVER=http://localhost
|
2022-11-06 23:20:45 +01:00
|
|
|
source ~/.bashrc
|
2023-09-08 03:15:47 +02:00
|
|
|
# Check that hishtory query runs without errors
|
2023-09-08 03:29:24 +02:00
|
|
|
./hishtory query
|
2023-09-18 06:25:37 +02:00
|
|
|
# Run a command such that hishtory will record it
|
|
|
|
echo -e 'ls -Slah /\n' | zsh -is
|
|
|
|
# Sleep to ensure there is time for it to be recorded, since recordings are async
|
|
|
|
sleep 1
|
2023-10-15 20:52:06 +02:00
|
|
|
# Check that it was recorded
|
2023-09-18 06:25:37 +02:00
|
|
|
./hishtory export | grep "ls -Slah /"
|
2023-10-15 20:52:06 +02:00
|
|
|
# Check that we can redact it
|
2023-10-15 21:32:05 +02:00
|
|
|
HISHTORY_REDACT_FORCE=1 ./hishtory redact ls Slah
|
2023-10-16 04:05:32 +02:00
|
|
|
# And that it was redacted
|
|
|
|
! (./hishtory export | grep "ls -Slah /")
|
2023-09-09 03:05:11 +02:00
|
|
|
# Assert that the entry is syncing properly
|
|
|
|
./hishtory status -v | grep 'Sync Status: Synced'
|
2023-09-24 05:38:35 +02:00
|
|
|
# - name: Setup tmate session
|
|
|
|
# if: ${{ failure() }}
|
|
|
|
# uses: mxschmitt/action-tmate@v3
|
|
|
|
# with:
|
|
|
|
# limit-access-to-actor: true
|