wip #31
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Docker Compose | |
uses: docker/setup-buildx-action@v2 | |
- name: Start Prometheus with Docker Compose | |
run: | | |
docker network create monitoring || true | |
docker volume create prom_data || true | |
docker run -d --name prometheus --restart unless-stopped \ | |
--network monitoring \ | |
-p 9090:9090 \ | |
-v ${{ github.workspace }}/aw-sync-suite/aw-sync-center/prometheus:/etc/prometheus \ | |
-v prom_data:/prometheus \ | |
prom/prometheus \ | |
--config.file=/etc/prometheus/prometheus.yml \ | |
--web.enable-remote-write-receiver | |
- name: Wait for Prometheus to start | |
run: sleep 50 | |
- name: Verify Prometheus is running | |
run: curl -s http://prometheus:9090/-/ready | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.23.2' | |
- name: Build aw-sync-agent | |
working-directory: aw-sync-agent | |
run: go build -o aw-sync-agent ./path/to/aw-sync-agent | |
- name: Run Go tests | |
working-directory: aw-sync-agent | |
run: go test ./... | |
- name: Set up ActivityWatch and agent | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget jq | |
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/ActivityWatch/activitywatch/releases/latest | jq -r '.assets[] | select(.name | endswith("linux-x86_64.zip")) | .browser_download_url') | |
wget $LATEST_RELEASE_URL -O activitywatch-latest-linux-x86_64.zip | |
unzip activitywatch-latest-linux-x86_64.zip -d activitywatch | |
./activitywatch/aw-qt & | |
# Run the built agent binary | |
./aw-sync-agent -prometheus-url http://localhost:9090 -aw-url http://localhost:5600 -immediate | |
- name: Check logs for success | |
run: | | |
if grep -q "Synchronization process finished successfully" <(docker logs aw-sync-agent); then | |
echo "Test passed" | |
else | |
echo "Test failed" | |
exit 1 |