mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
Add e2e tests to woodpecker
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user