From 58089515471476fc7c9b823dcaec2409f2127ef0 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Wed, 21 May 2025 09:34:48 +0200 Subject: [PATCH] Add e2e tests to woodpecker --- .woodpecker/e2e.yaml | 94 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .woodpecker/e2e.yaml diff --git a/.woodpecker/e2e.yaml b/.woodpecker/e2e.yaml new file mode 100644 index 000000000..0437ff17d --- /dev/null +++ b/.woodpecker/e2e.yaml @@ -0,0 +1,94 @@ +when: + - event: pull_request + - event: push + branch: main + +variables: + - &base_image "docker.io/sebastinez/radicle-desktop-base:latest_3" + - &cache_endpoint "https://minio-api.radworks.garden/build-caches/radicle-desktop/cache" + - &cache_dir "radicle-desktop/cache" + +steps: + cache: + image: *base_image + pull: true + environment: + CACHE_ENDPOINT: *cache_endpoint + CACHE_DIR: *cache_dir + entrypoint: + - "/bin/bash" + - "-c" + - | + set -euo pipefail + + # Initialize cache status file + echo "# Cache status" > .cache + + export ARCH=$(uname -m) + export RUST_VERSION=$(rustc --version | cut -d ' ' -f 2) + export RUST_HASH=$(sha256sum Cargo.lock | cut -d ' ' -f 1) + export FILE_NAME="rust-e2e-""$ARCH""-""$RUST_VERSION""-""$RUST_HASH"".tar.zst" + echo "FILE_NAME=$FILE_NAME" >> .cache + cat .cache + + # Create temporary directory for cache files + mkdir -p "$CACHE_DIR" + + echo "Checking cache..." + url="$CACHE_ENDPOINT""/""$FILE_NAME" + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --head $url) + + if [ "$HTTP_CODE" = "200" ]; then + echo "Cache hit! Downloading..." + curl -s -o "$CACHE_DIR""/""$FILE_NAME" $url + echo "CACHE_HIT=true" >> .cache + else + echo "No cache found (HTTP status: $HTTP_CODE)" + echo "CACHE_HIT=false" >> .cache + fi + end-to-end: + image: *base_image + pull: true + environment: + CACHE_ENDPOINT: *cache_endpoint + CACHE_DIR: *cache_dir + entrypoint: + - "/bin/bash" + - "-c" + - | + set -euo pipefail + + cat .cache + source .cache + + if [ "$CACHE_HIT" = "true" ]; then + echo "Extracting cache..." + tar --zstd -xf "$CACHE_DIR""/""$FILE_NAME" + fi + + ./scripts/install-binaries; + npm ci + npm run build:http + mkdir -p tests/artifacts; + + # Install and run playwright + npx playwright install webkit chromium --with-deps + npm run test:e2e -- --project webkit + + if [ "$CACHE_HIT" = "false" ]; then + echo "Creating debug cache archive..." + tar --zstd -cf "$CACHE_DIR""/""$FILE_NAME" target + fi + + upload-cache: + image: woodpeckerci/plugin-s3 + settings: + endpoint: https://minio-api.radworks.garden + bucket: build-caches + source: radicle-desktop/*/*.{tar.zst} + target: "" + path_style: true + access_key: + from_secret: minio_access_key + secret_key: + from_secret: minio_secret_key