chore: install deps using pacman (#6397)

* chore: install deps using pacman

* chore: use rust 1.80.1

* chore: add docker ci

* fix: docker ci

* chore: optimize docker-ci speed
This commit is contained in:
Lucas 2024-09-25 15:25:44 +08:00 committed by GitHub
parent 6a1619d300
commit a8a8502577
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 44 additions and 59 deletions

View file

@ -2,18 +2,10 @@ name: Docker-CI
on:
push:
branches:
- main
- release/*
paths:
- frontend/**
branches: ["main", "release/*"]
pull_request:
branches:
- main
- release/*
paths:
- frontend/**
types: [ opened, synchronize, reopened, unlocked, ready_for_review ]
branches: ["main", "release/*"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@ -27,25 +19,28 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Docker Compose
run: |
docker-compose --version || {
echo "Docker Compose not found, installing..."
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# cache the docker layers
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build the app
shell: bash
uses: docker/build-push-action@v5
with:
context: .
file: ./frontend/scripts/docker-buildfiles/Dockerfile
push: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
set -eu -o pipefail
cd frontend/scripts/docker-buildfiles
docker-compose build --no-cache --progress=plain \
| while read line; do \
if [[ "$line" =~ ^Step[[:space:]] ]]; then \
echo "$(date -u '+%H:%M:%S') | $line"; \
else \
echo "$line"; \
fi; \
done
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View file

@ -232,10 +232,10 @@ jobs:
matrix:
job:
- {
targets: "aarch64-apple-darwin,x86_64-apple-darwin",
os: macos-latest,
extra-build-args: "",
}
targets: "aarch64-apple-darwin,x86_64-apple-darwin",
os: macos-latest,
extra-build-args: "",
}
steps:
- name: Checkout source code
uses: actions/checkout@v4
@ -336,12 +336,12 @@ jobs:
matrix:
job:
- {
arch: x86_64,
target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04,
extra-build-args: "",
flutter_profile: production-linux-x86_64,
}
arch: x86_64,
target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04,
extra-build-args: "",
flutter_profile: production-linux-x86_64,
}
steps:
- name: Checkout source code
uses: actions/checkout@v4

View file

@ -17,39 +17,29 @@ ENV PATH="/home/$user/.pub-cache/bin:/home/$user/flutter/bin:/home/$user/flutter
USER $user
WORKDIR /home/$user
# Install yay
RUN sudo pacman -S --needed --noconfirm curl tar
RUN curl -sSfL \
--output yay.tar.gz \
https://github.com/Jguer/yay/releases/download/v12.3.3/yay_12.3.3_x86_64.tar.gz && \
tar -xf yay.tar.gz && \
sudo mv yay_12.3.3_x86_64/yay /bin && \
rm -rf yay_12.3.3_x86_64 && \
yay --version
# Install Rust
RUN yay -S --noconfirm curl base-devel openssl clang cmake ninja pkg-config xdg-user-dirs
# Install Rust and dependencies using pacman
RUN sudo pacman -S --needed --noconfirm curl base-devel openssl clang cmake ninja pkg-config xdg-user-dirs
RUN xdg-user-dirs-update
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN source ~/.cargo/env && \
rustup toolchain install 1.77.2 && \
rustup default 1.77.2
rustup toolchain install 1.80.1 && \
rustup default 1.80.1
# Install Flutter
RUN sudo pacman -S --noconfirm git tar gtk3
RUN curl -sSfL \
--output flutter.tar.xz \
https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.22.0-stable.tar.xz && \
--output flutter.tar.xz \
https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.22.0-stable.tar.xz && \
tar -xf flutter.tar.xz && \
rm flutter.tar.xz
RUN flutter config --enable-linux-desktop
RUN flutter doctor
RUN dart pub global activate protoc_plugin 21.1.2
# Install build dependencies for AppFlowy
RUN yay -S --noconfirm jemalloc4 cargo-make cargo-binstall
RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite clang rsync libnotify rocksdb zstd mpv
# Install build dependencies for AppFlowy using pacman
RUN sudo pacman -S --needed --noconfirm jemalloc git libkeybinder3 sqlite clang rsync libnotify rocksdb zstd mpv
RUN sudo ln -s /usr/bin/sha1sum /usr/bin/shasum
RUN source ~/.cargo/env && cargo install cargo-make cargo-binstall
RUN source ~/.cargo/env && cargo binstall duckscript_cli -y
# Build AppFlowy