hishtory/.github/workflows/docker-compose-test.yml

51 lines
1.8 KiB
YAML
Raw Normal View History

name: Self-Hosting Docker Compose Tests
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
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Docker Compose setup
if: ${{ !startsWith(github.event.head_commit.message, 'Release') }}
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y zsh fish
curl -fsSL https://get.docker.com | sudo sh
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
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
export HISHTORY_SERVER=http://localhost
go build
./hishtory install
- name: Docker Compose test
shell: bash -ileo pipefail {0}
if: ${{ !startsWith(github.event.head_commit.message, 'Release') }}
run: |
set -euo pipefail
export HISHTORY_SERVER=http://localhost
source ~/.bashrc
# Record a command that we'll check was persisted
ls -Slah /
# Assert that the entry is syncing properly
./hishtory status -v | grep 'Sync Status: Synced'
# Check that hishtory query runs without errors
./hishtory query
# Check that hishtory export recorded the above ls command
./hishtory export | grep "ls -Slah /"
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true