docs(playwright-engine): add UI and CLI guides and migration recipe #6507
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: Code build and checks | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- 'docs/**' | |
pull_request: | |
env: | |
VERSION: ${{ github.sha }} | |
TAG: latest | |
TRACETEST_ENV: ci | |
TRACETEST_DEV: true | |
CYPRESS_BASE_URL: http://localhost:11633 | |
POKEMON_HTTP_ENDPOINT: http://demo-api:8081 | |
# We need to remove the need for these secrets so anyone can run the pipeline | |
GORELEASER_KEY: ${{ secrets.GORELEASER_LICENSE }} | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
jobs: | |
unit-test-cli: | |
name: CLI unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
cache-dependency-path: "go.mod" | |
- name: Run unit tests | |
run: cd cli; make test | |
unit-test-server: | |
name: API Server unit tests | |
runs-on: ubuntu-latest | |
# git log --pretty=tformat:"%H" -n1 web | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
cache-dependency-path: "go.mod" | |
- name: Run unit tests | |
run: cd server; make test -B | |
unit-test-agent: | |
name: Agent unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
cache-dependency-path: "go.mod" | |
- name: Run unit tests | |
run: cd agent; make test -B | |
unit-test-web: | |
name: WebUI unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: npm | |
cache-dependency-path: web/package-lock.json | |
- name: Cache dependencies | |
id: cache-nodemodules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
web/node_modules | |
/home/runner/.cache/Cypress | |
key: npm--${{ hashFiles('web/package-lock.json') }} | |
restore-keys: npm- | |
- run: cd web; npm ci | |
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
- run: cd web; npm run lint && npm test | |
build-docker: | |
name: Build docker image | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_CLI_EXPERIMENTAL: "enabled" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# web | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: npm | |
cache-dependency-path: web/package-lock.json | |
- name: Install dependencies | |
run: cd web/; npm ci | |
- name: Build UI | |
run: cd web; CI= npm run build | |
# go+docker | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
cache-dependency-path: "go.mod" | |
- name: Release Go binaries | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser-pro | |
version: v2.0.1 | |
args: release --skip=announce --snapshot -f .goreleaser.dev.yaml | |
- name: Move binaries to known location | |
run: | | |
find ./dist -name 'tracetest' -exec cp {} ./dist \; | |
find ./dist -name 'tracetest-server' -exec cp {} ./dist \; | |
chmod +x ./dist/tracetest ./dist/tracetest-server | |
- name: Export docker image | |
run: | | |
docker save --output dist/image.tar "kubeshop/tracetest:$TAG" | |
- name: Upload assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tracetest-dist | |
path: dist/ | |
test-examples: | |
name: Test examples | |
needs: [build-docker] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
example_dir: | |
- collector | |
- tracetest-jaeger | |
- tracetest-opensearch | |
- tracetest-tempo | |
- tracetest-provisioning-env | |
# - tracetest-signoz # signoz is unstable, we need to review their docker compose structure | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tracetest-dist | |
path: dist/ | |
- name: Import image | |
run: | | |
docker load --input dist/image.tar | |
- name: Build example | |
run: | | |
cd examples/${{ matrix.example_dir }} | |
docker compose up -d | |
docker compose logs -f > /tmp/docker-log & | |
- name: Run example test | |
run: | | |
chmod +x ./dist/tracetest | |
./scripts/wait-for-port.sh 11633 | |
./dist/tracetest configure -g --server-url http://localhost:11633 | |
./dist/tracetest run test -f examples/${{ matrix.example_dir }}/tests/list-tests.yaml || (cat /tmp/docker-log; exit 1) | |
smoke-test-cli: | |
name: CLI smoke tests | |
needs: [build-docker] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
test_env: | |
- local | |
- docker | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tracetest-dist | |
path: dist/ | |
- name: Import image | |
run: | | |
docker load --input dist/image.tar | |
- name: Start server | |
run: | | |
cd examples/collector | |
docker compose up -d | |
docker compose logs -f > /tmp/docker-log & | |
- name: Run tests | |
run: | | |
chmod +x ./dist/tracetest ./testing/cli-smoketest/run.bash | |
./scripts/wait-for-port.sh 11633 | |
cd ./testing/cli-smoketest | |
TRACETEST_CLI="../../dist/tracetest" \ | |
TEST_ENV="${{ matrix.test_env }}" \ | |
./run.bash || (cat /tmp/docker-log; exit 1) | |
trace-testing-memory: | |
needs: [build-docker] | |
name: Tracetesting API Server (InMemory) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tracetest-dist | |
path: dist/ | |
- name: Import image | |
run: | | |
docker load --input dist/image.tar | |
- name: Start services | |
run: | | |
./run.sh down up | |
./run.sh tracetest-logs > /tmp/docker-log & | |
- name: Run tests | |
run: | | |
chmod +x ./dist/tracetest ./dist/tracetest-server | |
./scripts/wait-for-port.sh 11633 | |
./run.sh tracetests || (cat /tmp/docker-log; exit 1) | |
trace-testing-nats: | |
needs: [build-docker] | |
name: Tracetesting API Server (NATS) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tracetest-dist | |
path: dist/ | |
- name: Import image | |
run: | | |
docker load --input dist/image.tar | |
- name: Start services | |
run: | | |
./run.sh down up | |
./run.sh tracetest-logs > /tmp/docker-log & | |
- name: Run tests | |
run: | | |
chmod +x ./dist/tracetest ./dist/tracetest-server | |
./scripts/wait-for-port.sh 11633 | |
NATS=true ./run.sh tracetests || (cat /tmp/docker-log; exit 1) | |
e2e-cli: | |
name: CLI e2e tests | |
needs: [build-docker] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
total_splits: [8] | |
index: [0,1,2,3,4,5,6,7] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
cache-dependency-path: "go.mod" | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tracetest-dist | |
path: dist/ | |
- name: Import image | |
run: | | |
docker load --input dist/image.tar | |
- name: Run tests | |
run: | | |
curl -sfL https://raw.githubusercontent.com/Songmu/gotesplit/main/install.sh | sh -s | |
find ./dist -name 'tracetest' -exec cp {} ./dist \; | |
chmod +x ./dist/tracetest | |
export TRACETEST_CLI=$PWD/dist/tracetest | |
export TEST_ENVIRONMENT=jaeger | |
cd ./testing/cli-e2etest | |
../../bin/gotesplit -total ${{ matrix.total_splits }} -index ${{ matrix.index }} ./... -- -v -timeout 300s -p 1 | |
# TODO: this would be a great idea but it doesn't work on GHA with docker | |
# it can probablly be implemented with k8s in a separated job | |
# I'm leaving this as a reference and as a reminder to do it | |
# k6-test: | |
# name: k6 Load Test | |
# needs: [build-docker] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# - name: Setup go | |
# uses: actions/setup-go@v3 | |
# with: | |
# go-version-file: "go.mod" | |
# cache: true | |
# cache-dependency-path: "go.mod" | |
# - uses: actions/download-artifact@v3 | |
# with: | |
# name: tracetest-dist | |
# path: dist/ | |
# - name: Import image | |
# run: | | |
# docker load --input dist/image.tar | |
# - name: Run tests | |
# run: | | |
# chmod +x ./dist/tracetest ./testing/load/run.bash | |
# cd ./testing/load | |
# export TRACETEST_CLI="../../dist/tracetest" | |
# ./run.bash || (cat /tmp/docker-log; exit 1) | |
config-e2e: | |
runs-on: ubuntu-latest | |
outputs: | |
CYPRESS_CONTAINERS: ${{ steps.configure-cypress-containers.outputs.CYPRESS_CONTAINERS }} | |
steps: | |
- name: Configure Cypress containers | |
id: configure-cypress-containers | |
run: | | |
# env.CYPRESS_RECORD_KEY is required for parallelization, so if it's empty run a single container | |
if [ "${{env.CYPRESS_RECORD_KEY}}" = "" ]; then | |
echo "CYPRESS_CONTAINERS=[1]" >> $GITHUB_OUTPUT | |
else | |
echo "CYPRESS_CONTAINERS=[1,2,3,4,5,6,7,8]" >> $GITHUB_OUTPUT | |
fi | |
e2e: | |
needs: [build-docker, config-e2e] | |
name: WebUI End-to-end tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
# run copies of the current job in parallel | |
containers: ${{fromJson(needs.config-e2e.outputs.CYPRESS_CONTAINERS)}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: npm | |
cache-dependency-path: web/package-lock.json | |
- name: Cache dependencies | |
id: cache-nodemodules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
web/node_modules | |
/home/runner/.cache/Cypress | |
key: npm--${{ hashFiles('web/package-lock.json') }} | |
restore-keys: npm- | |
- name: Install dependencies | |
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
run: cd web/; npm ci | |
- uses: actions/download-artifact@v3 | |
with: | |
name: tracetest-dist | |
path: dist/ | |
- name: Import image | |
run: | | |
docker load --input dist/image.tar | |
- name: Run integration tests | |
run: | | |
./run.sh down up | |
./run.sh tracetest-logs > /tmp/docker-log & | |
./scripts/wait-for-port.sh 11633 | |
if [ "${{env.CYPRESS_RECORD_KEY}}" = "" ]; then | |
# if this is not container #1, the script won't get here, so don't need for additional checks | |
./run.sh cypress | |
else | |
./run.sh cypress-ci | |
fi |