Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add e2e tests to woodpecker
Sebastian Martinez committed 0 years ago
commit e486dd9a6e3efd72edcd665f9f79d6a5d9a7bafc
parent 9a60ba76bce718626f9c4d1e55f524d2587db0f2
1 file changed +98 -0
added .woodpecker/e2e.yaml
@@ -0,0 +1,98 @@
+
when:
+
  - event: pull_request
+
  - event: push
+
    branch: main
+
  - event: tag
+
    ref: refs/namespaces/z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx/tags/v[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z]+)?(\.[0-9]+)? # Matches v1.2.3, v1.2.3-rc, v1.2.3-rc.1, etc.
+
  - event: tag
+
    ref: refs/namespaces/z6MkkfM3tPXNPrPevKr3uSiQtHPuwnNhu2yUVjgd2jXVsVz5/tags/v[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z]+)?(\.[0-9]+)? # Matches v1.2.3, v1.2.3-rc, v1.2.3-rc.1, etc.
+

+
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