Skip to content

chore: add GitHub issue templates to improve issue quality (832deece1014edbe67a37040b00f77f17c0b16c5) #2857

chore: add GitHub issue templates to improve issue quality (832deece1014edbe67a37040b00f77f17c0b16c5)

chore: add GitHub issue templates to improve issue quality (832deece1014edbe67a37040b00f77f17c0b16c5) #2857

Workflow file for this run

name: ci
run-name: ${{ github.event.pull_request.title || format('Push to {0}', github.ref_name) }} (${{ github.event.pull_request.head.sha || github.sha }})
permissions:
id-token: write
contents: read
on:
push:
branches:
- main # Only run on pushes to main
pull_request:
branches: ['**'] # Run on PRs targeting any branch
env:
GITHUB_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- run: mono lint
test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- run: mono test unit
test-integration-node-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- name: Set OTEL_EXPORTER_OTLP_HEADERS environment variable
env:
GRAFANA_CLOUD_OTLP_INSTANCE_ID: 1227256
GRAFANA_CLOUD_OTLP_API_KEY: ${{ secrets.GRAFANA_CLOUD_OTLP_API_KEY }}
run: |
echo "OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic $(echo -n "$GRAFANA_CLOUD_OTLP_INSTANCE_ID:$GRAFANA_CLOUD_OTLP_API_KEY" | base64 -w 0)" >> $GITHUB_ENV
echo "GRAFANA_ENDPOINT=https://livestore.grafana.net" >> $GITHUB_ENV
echo "OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp-gateway-prod-us-east-2.grafana.net/otlp" >> $GITHUB_ENV
# Disable in Vite (otherwise CORS issues)
echo "VITE_OTEL_EXPORTER_OTLP_ENDPOINT=" >> $GITHUB_ENV
- run: mono test integration node-sync
- name: Display node-sync logs
if: always()
run: |
if [ -d "tests/integration/tmp/logs" ]; then
echo "::group::Node-sync test logs"
for log_file in tests/integration/tmp/logs/*.log; do
if [ -f "$log_file" ]; then
echo "::group::$(basename "$log_file")"
cat "$log_file"
echo "::endgroup::"
fi
done
echo "::endgroup::"
else
echo "No log files found"
fi
- uses: actions/upload-artifact@v4
if: always()
with:
name: node-sync-logs
path: tests/integration/tmp/logs/
retention-days: 30
test-integration-sync-provider:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- name: Set OTEL_EXPORTER_OTLP_HEADERS environment variable
env:
GRAFANA_CLOUD_OTLP_INSTANCE_ID: 1227256
GRAFANA_CLOUD_OTLP_API_KEY: ${{ secrets.GRAFANA_CLOUD_OTLP_API_KEY }}
run: |
echo "OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic $(echo -n "$GRAFANA_CLOUD_OTLP_INSTANCE_ID:$GRAFANA_CLOUD_OTLP_API_KEY" | base64 -w 0)" >> $GITHUB_ENV
echo "GRAFANA_ENDPOINT=https://livestore.grafana.net" >> $GITHUB_ENV
echo "OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp-gateway-prod-us-east-2.grafana.net/otlp" >> $GITHUB_ENV
# Disable in Vite (otherwise CORS issues)
echo "VITE_OTEL_EXPORTER_OTLP_ENDPOINT=" >> $GITHUB_ENV
- run: mono test integration sync-provider
test-integration-playwright:
strategy:
matrix:
suite: [misc, todomvc, devtools]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- name: Set OTEL_EXPORTER_OTLP_HEADERS environment variable
env:
GRAFANA_CLOUD_OTLP_INSTANCE_ID: 1227256
GRAFANA_CLOUD_OTLP_API_KEY: ${{ secrets.GRAFANA_CLOUD_OTLP_API_KEY }}
run: |
echo "OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic $(echo -n "$GRAFANA_CLOUD_OTLP_INSTANCE_ID:$GRAFANA_CLOUD_OTLP_API_KEY" | base64 -w 0)" >> $GITHUB_ENV
echo "GRAFANA_ENDPOINT=https://livestore.grafana.net" >> $GITHUB_ENV
echo "OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp-gateway-prod-us-east-2.grafana.net/otlp" >> $GITHUB_ENV
# Disable in Vite (otherwise CORS issues)
echo "VITE_OTEL_EXPORTER_OTLP_ENDPOINT=" >> $GITHUB_ENV
- name: Run integration tests
env:
PLAYWRIGHT_SUITE: ${{ matrix.suite }}
run: |
if [ "${{ matrix.suite }}" = "devtools" ]; then
# TODO fix flaky devtools test
mono test integration devtools || echo "::warning::Script failed but continuing"
else
mono test integration ${{ matrix.suite }}
fi
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.suite }}
path: tests/integration/playwright-report/
retention-days: 30
- name: "Upload trace"
if: ${{ !cancelled() }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
PLAYWRIGHT_SUITE: ${{ matrix.suite }}
# TODO surface deploy url in github UI via environments
run: |
if [ -n "$NETLIFY_AUTH_TOKEN" ]; then
bunx netlify-cli deploy --no-build --dir=tests/integration/playwright-report --site livestore-ci --filter @local/tests-integration --alias ${{ matrix.suite }}-$(git rev-parse --short HEAD)
else
echo "Skipping Netlify deploy: NETLIFY_AUTH_TOKEN not set"
fi
perf-test:
runs-on: ubuntu-24.04 # Prefer a specific version for more consistent performance measurements between runs
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }} # See https://github.com/orgs/community/discussions/26325
- name: Set up environment
uses: ./.github/actions/setup-env
- name: Set OTEL_EXPORTER_OTLP_HEADERS environment variable
env:
GRAFANA_CLOUD_OTLP_INSTANCE_ID: 1227256
GRAFANA_CLOUD_OTLP_API_KEY: ${{ secrets.GRAFANA_CLOUD_OTLP_API_KEY }}
run: echo "OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic $(echo -n "$GRAFANA_CLOUD_OTLP_INSTANCE_ID:$GRAFANA_CLOUD_OTLP_API_KEY" | base64 -w 0)" >> $GITHUB_ENV
- name: Run performance tests
run: mono test perf
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} # See https://github.com/orgs/community/discussions/26325
GRAFANA_ENDPOINT: https://livestore.grafana.net
OTEL_EXPORTER_OTLP_ENDPOINT: https://otlp-gateway-prod-us-east-2.grafana.net/otlp
wa-sqlite-test:
runs-on: ubuntu-24.04 # Prefer a specific version for more consistent performance measurements between runs
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- name: Set OTEL_EXPORTER_OTLP_HEADERS environment variable
env:
GRAFANA_CLOUD_OTLP_INSTANCE_ID: 1227256
GRAFANA_CLOUD_OTLP_API_KEY: ${{ secrets.GRAFANA_CLOUD_OTLP_API_KEY }}
run: echo "OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic $(echo -n "$GRAFANA_CLOUD_OTLP_INSTANCE_ID:$GRAFANA_CLOUD_OTLP_API_KEY" | base64 -w 0)" >> $GITHUB_ENV
- name: Build wa-sqlite
working-directory: packages/@livestore/wa-sqlite
run: nix run .#build
- name: Run wa-sqlite tests
run: mono test integration wa-sqlite
env:
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} # See https://github.com/orgs/community/discussions/26325
GRAFANA_ENDPOINT: https://livestore.grafana.net
OTEL_EXPORTER_OTLP_ENDPOINT: https://otlp-gateway-prod-us-east-2.grafana.net/otlp
publish-snapshot-version:
if: github.event.pull_request.head.repo.fork != true
runs-on: ubuntu-latest
needs: [test-unit, test-integration-node-sync, test-integration-sync-provider, test-integration-playwright]
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- name: Configure NPM authentication
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: mono release snapshot --git-sha=${{ github.sha }}
build-and-deploy-examples-src:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- run: |
mono examples deploy \
--prod=${{ github.ref == 'refs/heads/main' && 1 || 0 }} \
--alias=snapshot-$(git rev-parse --short HEAD)
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
VITE_LIVESTORE_SYNC_URL: 'https://websocket-server.schickling.workers.dev'
build-deploy-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup-env
- run: mono docs build --api-docs
- run: mono docs deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
build-example-tiged:
if: github.event.pull_request.head.repo.fork != true
needs: publish-snapshot-version
strategy:
matrix:
app: [web-todomvc, web-linearlite, expo-linearlite]
runs-on: ubuntu-latest
env:
APP_PATH: examples/${{ matrix.app }}
SNAPSHOT_VERSION: "0.0.0-snapshot-${{ github.sha }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
# We're only using pnpm instead of the ./.github/actions/setup-env action to simulate a simple, user-facing setup.
uses: pnpm/action-setup@v4
with:
standalone: true
run_install: true
- name: Get app’s workspace dependencies
working-directory: ${{ env.APP_PATH }}
run: |
echo "WORKSPACE_DEPS=$( \
pnpm list --only-projects --json | \
jq -r '.[0].dependencies | keys | join(" ")' \
)" >> $GITHUB_ENV
- name: Copy example app
# We use `github.ref_name` instead of `github.sha` because, when a workflow is triggered by a pull request,
# `github.sha` refers to a temporary commit SHA that can become inaccessible in some contexts.
# See https://www.kenmuse.com/blog/the-many-shas-of-a-github-pull-request/
run: pnpm dlx tiged github:${{ github.repository }}/${{ env.APP_PATH }}#${{ github.ref_name }} ${{ runner.temp }}/${{ env.APP_PATH }}
- name: Increase pnpm fetch retries
# Sometimes the snapshot version is not available immediately after publishing due to network propagation delays.
# We increase the fetch retries to mitigate this issue.
# See https://pnpm.io/settings#fetchretries
run: pnpm config set fetchRetries 3
- name: Use snapshot version of workspace dependencies
working-directory: ${{ runner.temp }}/${{ env.APP_PATH }}
run: |
pnpm add $(
for dep in $WORKSPACE_DEPS; do
echo "$dep@${{ env.SNAPSHOT_VERSION }}"
done
)
- if: ${{ matrix.app != 'expo-linearlite' }} # TODO: build expo app with EAS
working-directory: ${{ runner.temp }}/${{ env.APP_PATH }}
run: pnpm build
check-nix-flake-inputs:
# Performs health checks on the flake.lock file to ensure we stay on recent and supported versions of Nixpkgs.
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@main
with:
flake-lock-path: ./nix/flake.lock