diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml index ce4dfca88..195464886 100644 --- a/.woodpecker/build.yaml +++ b/.woodpecker/build.yaml @@ -4,62 +4,50 @@ when: 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" + - &plugin-sccache-read-only + s3-bucket: "build-caches" + s3-endpoint: "https://minio-api.radworks.garden" + s3-key-prefix: "radicle-desktop" + save-if: "false" + s3-access-key: + from_secret: minio_access_key + s3-secret-access-key: + from_secret: minio_secret_key steps: - cache: - image: *base_image + read_cache: + image: quay.io/radicle_garden/plugin-sccache:latest pull: true - environment: - CACHE_ENDPOINT: *cache_endpoint - CACHE_DIR: *cache_dir - entrypoint: - - "/bin/bash" - - "-c" - - | - set -euo pipefail + volumes: + - sccache:/sccache_data + settings: *plugin-sccache-read-only - # 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-""$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 + update_cache: + image: quay.io/radicle_garden/plugin-sccache:latest + pull: true + when: + evaluate: 'CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH && CI_COMMIT_MESSAGE startsWith "Release"' + volumes: + - sccache:/sccache_data + settings: + <<: *plugin-sccache-read-only + save-if: true build: - image: *base_image - depends_on: [cache] - pull: true + image: quay.io/radicle_garden/radicle-desktop-base:latest + volumes: + - sccache:/sccache_data environment: CI: true - CACHE_DIR: *cache_dir entrypoint: - "/bin/bash" - "-c" - | set -euo pipefail + export PATH="/sccache_data:$PATH" + source .sccache + export VERSION=$(jq -r '.version' crates/radicle-tauri/tauri.conf.json) export ARTIFACT_DIR="radicle-desktop/pre-release/""$VERSION""_""${CI_COMMIT_SHA:0:8}" export LATEST_DIR="radicle-desktop/latest" @@ -69,23 +57,11 @@ steps: mkdir -p "$LATEST_DIR""/appimage" echo $ARTIFACT_DIR echo $LATEST_DIR - echo $CACHE_DIR - - cat .cache - source .cache - - if [ "$CACHE_HIT" = "true" ]; then - echo "Extracting cache..." - tar --zstd -xf $CACHE_DIR/$FILE_NAME - fi npm ci npm run tauri build - if [ "$CACHE_HIT" = "false" ]; then - echo "Creating cache archive..." - tar --zstd -cf $CACHE_DIR/$FILE_NAME target - fi + sccache --show-stats # Organize build artifacts for upload cp target/release/bundle/deb/*.deb "$ARTIFACT_DIR" @@ -96,23 +72,8 @@ steps: cp target/release/bundle/appimage/*.AppImage "$LATEST_DIR/appimage" echo "{\"sha\": \"$(git rev-parse HEAD)\"}" > "$LATEST_DIR/sha.json" - upload-cache: - image: woodpeckerci/plugin-s3 - depends_on: [build] - 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 - upload-artifacts: image: woodpeckerci/plugin-s3 - depends_on: [build] settings: endpoint: https://minio-api.radworks.garden bucket: radworks-releases @@ -126,9 +87,8 @@ steps: release: image: woodpeckerci/plugin-s3 - depends_on: [build] when: - - evaluate: 'CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH && CI_COMMIT_MESSAGE == "^Release"' + - evaluate: 'CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH && CI_COMMIT_MESSAGE startsWith "Release"' settings: endpoint: https://minio-api.radworks.garden bucket: radworks-releases diff --git a/.woodpecker/docker/playwright.Dockerfile b/.woodpecker/docker/playwright.Dockerfile new file mode 100644 index 000000000..626639b2e --- /dev/null +++ b/.woodpecker/docker/playwright.Dockerfile @@ -0,0 +1,26 @@ +FROM mcr.microsoft.com/playwright:v1.52.0-noble + +# Install Rust +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.84-x86_64-unknown-linux-gnu +ENV PATH="/root/.cargo/bin:${PATH}" + +RUN apt-get update && apt-get install -y \ + build-essential \ + jq \ + curl \ + git \ + wget \ + file \ + zstd \ + libxdo-dev \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev \ + libwebkit2gtk-4.1-0=2.44.0-2 \ + libwebkit2gtk-4.1-dev=2.44.0-2 \ + libjavascriptcoregtk-4.1-0=2.44.0-2 \ + libjavascriptcoregtk-4.1-dev=2.44.0-2 \ + gir1.2-javascriptcoregtk-4.1=2.44.0-2 \ + gir1.2-webkit2-4.1=2.44.0-2 + +SHELL ["/bin/bash", "-c"] diff --git a/.woodpecker/e2e.yaml b/.woodpecker/e2e.yaml index 0437ff17d..143022fc0 100644 --- a/.woodpecker/e2e.yaml +++ b/.woodpecker/e2e.yaml @@ -4,67 +4,50 @@ when: 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" + - &plugin-sccache-read-only + s3-bucket: "build-caches" + s3-endpoint: "https://minio-api.radworks.garden" + s3-key-prefix: "radicle-desktop" + save-if: "false" + s3-access-key: + from_secret: minio_access_key + s3-secret-access-key: + from_secret: minio_secret_key + +# test steps: - cache: - image: *base_image + read_cache: + image: quay.io/radicle_garden/plugin-sccache:latest pull: true - environment: - CACHE_ENDPOINT: *cache_endpoint - CACHE_DIR: *cache_dir - entrypoint: - - "/bin/bash" - - "-c" - - | - set -euo pipefail + volumes: + - sccache:/sccache_data + settings: *plugin-sccache-read-only - # Initialize cache status file - echo "# Cache status" > .cache + update_cache: + image: quay.io/radicle_garden/plugin-sccache:latest + pull: true + when: + evaluate: 'CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH && CI_COMMIT_MESSAGE startsWith "Release"' + volumes: + - sccache:/sccache_data + settings: + <<: *plugin-sccache-read-only + save-if: true - 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 + image: quay.io/radicle_garden/radicle-desktop-e2e:latest pull: true - environment: - CACHE_ENDPOINT: *cache_endpoint - CACHE_DIR: *cache_dir + volumes: + - sccache:/sccache_data 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 + export PATH="/sccache_data:$PATH" + source .sccache ./scripts/install-binaries; npm ci @@ -72,23 +55,6 @@ steps: 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 + sccache --show-stats diff --git a/.woodpecker/lint.yaml b/.woodpecker/lint.yaml index e608aa938..824fd6574 100644 --- a/.woodpecker/lint.yaml +++ b/.woodpecker/lint.yaml @@ -4,52 +4,37 @@ when: 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" + - &plugin-sccache-read-only + s3-bucket: "build-caches" + s3-endpoint: "https://minio-api.radworks.garden" + s3-key-prefix: "radicle-desktop" + save-if: "false" + s3-access-key: + from_secret: minio_access_key + s3-secret-access-key: + from_secret: minio_secret_key steps: - cache: - image: *base_image + read_cache: + image: quay.io/radicle_garden/plugin-sccache:latest pull: true - environment: - CACHE_ENDPOINT: *cache_endpoint - CACHE_DIR: *cache_dir - entrypoint: - - "/bin/bash" - - "-c" - - | - set -euo pipefail + volumes: + - sccache:/sccache_data + settings: *plugin-sccache-read-only - # 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-debug-""$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 + update_cache: + image: quay.io/radicle_garden/plugin-sccache:latest + pull: true + when: + evaluate: 'CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == CI_REPO_DEFAULT_BRANCH && CI_COMMIT_MESSAGE startsWith "Release"' + volumes: + - sccache:/sccache_data + settings: + <<: *plugin-sccache-read-only + save-if: true lint_typescript: image: docker.io/library/node:22.11.0 - depends_on: [] entrypoint: - "/bin/bash" - "-c" @@ -58,44 +43,21 @@ steps: npm ci npm run check-js + lint_rust: - image: docker.io/sebastinez/radicle-desktop-base:latest_3 + image: quay.io/radicle_garden/radicle-desktop-base:latest pull: true - depends_on: [cache] - environment: - CACHE_DIR: *cache_dir + volumes: + - sccache:/sccache_data entrypoint: - "/bin/bash" - "-c" - | set -euo pipefail - cat .cache - source .cache + export PATH="/sccache_data:$PATH" + source .sccache - if [ "$CACHE_HIT" = "true" ]; then - echo "Extracting cache..." - tar --zstd -xf "$CACHE_DIR""/""$FILE_NAME" - fi - - # Pointing to check-rs directly to avoid installing npm scripts/check-rs - 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 - depends_on: [lint_rust] - 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 + sccache --show-stats diff --git a/rust-toolchain b/rust-toolchain index 40671b908..1a17bdc17 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.84 +1.84.1