From a0b7cf21fc1a005ae10d5bdcf85cd23c2e41d09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Wed, 21 Feb 2024 11:18:15 -0300 Subject: [PATCH] Fix mobile CI + Some small CI improvements (#2113) Fix mobile CI - Use rust envvars in all workflows - Use rust envvars and mold when build sd-server docker --- .github/actions/setup-system/action.yml | 2 +- .github/workflows/cache-factory.yaml | 6 +++--- .github/workflows/ci.yml | 5 +++++ .github/workflows/mobile-ci.yml | 7 ++++++- .github/workflows/release.yml | 6 ++++++ apps/server/docker/Dockerfile | 11 ++++++++++- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup-system/action.yml b/.github/actions/setup-system/action.yml index f6b46dfab..a440e8662 100644 --- a/.github/actions/setup-system/action.yml +++ b/.github/actions/setup-system/action.yml @@ -46,7 +46,7 @@ runs: if: ${{ runner.os != 'Linux' }} uses: ilammy/setup-nasm@v1 - - name: Install Mold + - name: Install Mold (linker) shell: bash if: ${{ runner.os == 'Linux' }} run: | diff --git a/.github/workflows/cache-factory.yaml b/.github/workflows/cache-factory.yaml index c5ddccc2a..7bccbddc8 100644 --- a/.github/workflows/cache-factory.yaml +++ b/.github/workflows/cache-factory.yaml @@ -64,6 +64,9 @@ jobs: remove-haskell: 'true' remove-docker-images: 'true' + - name: Checkout repository + uses: actions/checkout@v4 + - name: Symlink target to C:\ if: ${{ runner.os == 'Windows' }} shell: powershell @@ -71,9 +74,6 @@ jobs: New-Item -ItemType Directory -Force -Path C:\spacedrive_target New-Item -Path target -ItemType Junction -Value C:\spacedrive_target - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup System and Rust uses: ./.github/actions/setup-system with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03cdd321f..1d8241e65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,11 @@ on: env: SPACEDRIVE_CUSTOM_APT_FLAGS: --no-install-recommends + # From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/ci.yaml + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + RUST_BACKTRACE: short + RUSTUP_MAX_RETRIES: 10 # Cancel previous runs of the same workflow on the same branch. concurrency: diff --git a/.github/workflows/mobile-ci.yml b/.github/workflows/mobile-ci.yml index df7ca272f..9858522d2 100644 --- a/.github/workflows/mobile-ci.yml +++ b/.github/workflows/mobile-ci.yml @@ -18,6 +18,11 @@ on: env: SPACEDRIVE_CUSTOM_APT_FLAGS: --no-install-recommends SPACEDRIVE_CI: '1' + # From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/ci.yaml + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + RUST_BACKTRACE: short + RUSTUP_MAX_RETRIES: 10 # Cancel previous runs of the same workflow on the same branch. concurrency: @@ -199,7 +204,7 @@ jobs: - name: Run Simulator uses: futureware-tech/simulator-action@v2 with: - model: 'iPhone 11' + model: 'iPhone SE (3rd generation)' - name: Run Tests run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a11358236..ed1affc0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,12 @@ on: workflow_dispatch: # NOTE: For Linux builds, we can only build with Ubuntu. It should be the oldest base system we intend to support. See PR-759 & https://tauri.app/v1/guides/building/linux for reference. +# From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/release.yaml#L13-L21 +env: + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + RUSTUP_MAX_RETRIES: 10 + jobs: desktop-main: strategy: diff --git a/apps/server/docker/Dockerfile b/apps/server/docker/Dockerfile index 167219837..d74b9fd85 100644 --- a/apps/server/docker/Dockerfile +++ b/apps/server/docker/Dockerfile @@ -20,7 +20,7 @@ RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/ FROM base as build-base RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \ - apt-get install build-essential git sudo unzip wget + apt-get install build-essential git sudo unzip wget curl RUN wget -qO- https://get.pnpm.io/install.sh | env SHELL=bash PNPM_HOME=/usr/share/pnpm sh - @@ -60,6 +60,15 @@ RUN wget -qO- https://sh.rustup.rs | sh -s -- -yq --profile minimal ENV PATH="/root/.cargo/bin:$PATH" +# From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/release.yaml#L13-L21 +ENV CARGO_NET_RETRY=10 +ENV CARGO_INCREMENTAL=0 +ENV RUSTUP_MAX_RETRIES=10 + +# Install mold (linker) +RUN curl -L# 'https://github.com/rui314/mold/releases/download/v2.4.0/mold-2.4.0-x86_64-linux.tar.gz' \ + | sudo tar -xzf- -C /usr/local + RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \ env CI=true ./scripts/setup.sh