Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into community
Browse files Browse the repository at this point in the history
  • Loading branch information
J-ZhengLi committed Dec 27, 2024
2 parents c8534b7 + 45ea973 commit b1b3c1d
Show file tree
Hide file tree
Showing 68 changed files with 2,093 additions and 1,081 deletions.
155 changes: 72 additions & 83 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,99 +11,88 @@ on:

jobs:
release:
name: "Job - ${{ matrix.name }}"
runs-on: "${{ matrix.os }}"
env:
CI_JOB_NAME: "${{ matrix.name }}"

strategy:
fail-fast: false
fail-fast: true
matrix:
include:
- os: 'ubuntu-20.04'
target: x86_64-unknown-linux-gnu
- os: 'windows-latest'
target: x86_64-pc-windows-msvc
target-gnu: x86_64-pc-windows-gnu
- name: dist-aarch64-linux-gnu
os: ubuntu-20.04
target: aarch64-unknown-linux-gnu

runs-on: ${{ matrix.os }}
- name: dist-x86-64-linux-gnu
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu

steps:
- uses: actions/checkout@v4
- name: dist-aarch64-linux-musl
os: ubuntu-20.04
target: aarch64-unknown-linux-musl

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: dist-x86-64-linux-musl
os: ubuntu-20.04
target: x86_64-unknown-linux-musl

- name: setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: dist-windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
target-gnu: x86_64-pc-windows-gnu

- name: install Rust toolchain
run: rustup toolchain install stable --profile minimal --no-self-update
steps:
- name: checkout the source code
uses: actions/checkout@v4

- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Set up QEMU for ARM64
if: contains(matrix.target, 'aarch64')
uses: docker/setup-qemu-action@v2
with:
platforms: aarch64

- name: Set up QEMU for multiple cores
if: contains(matrix.target, 'aarch64')
run: |
echo "Setting up QEMU with multiple cores"
export QEMU_CPUS=4 # 设置虚拟 CPU 核心数为 4
# 设置 QEMU 使用多个核心
echo "Using $QEMU_CPUS CPUs with QEMU"
- name: setup tauri-cli
shell: bash
run: |
mkdir ./cargo_tauri
if [[ ${{ matrix.os }} == 'windows-latest' ]]; then
curl -OL https://github.com/tauri-apps/tauri/releases/download/tauri-cli-v1.6.3/cargo-tauri-x86_64-pc-windows-msvc.zip
unzip cargo-tauri-x86_64-pc-windows-msvc.zip -d ./cargo_tauri
mv ./cargo_tauri/cargo-tauri.exe ~/.cargo/bin
fi
if [[ ${{ matrix.os }} == 'ubuntu-20.04' ]]; then
curl -OL https://github.com/tauri-apps/tauri/releases/download/tauri-cli-v1.6.3/cargo-tauri-x86_64-unknown-linux-gnu.tgz
tar -xf cargo-tauri-x86_64-unknown-linux-gnu.tgz -C ./cargo_tauri
mv ./cargo_tauri/cargo-tauri ~/.cargo/bin
fi
- name: run build job
run: bash ci/run.sh

- name: configure cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
resources/packages/
target/
key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}

- name: dist
run: |
cargo dev vendor
cargo dev dist
- name: prepare packages (windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
set -x
export LANG=C.UTF-8
NAME=$(grep -Po 'vendor_en": "\K[^"]*' locales/en.json)
mkdir ./dist/binaries/
mv ./dist/${{ matrix.target-gnu }}/$NAME-installer.exe ./dist/binaries/$NAME-installer-${{ matrix.target-gnu }}.exe
mv ./dist/${{ matrix.target }}/$NAME-installer.exe ./dist/binaries/$NAME-installer-${{ matrix.target }}.exe
cd ./dist/${{ matrix.target-gnu }}
rm -f $NAME-${{ matrix.target-gnu }}/$NAME-installer-cli.exe
7z a ../binaries/$NAME-${{ matrix.target-gnu }}.zip $NAME-${{ matrix.target-gnu }}
cd ../${{ matrix.target }}
rm -f $NAME-${{ matrix.target }}/$NAME-installer-cli.exe
7z a ../binaries/$NAME-${{ matrix.target }}.zip $NAME-${{ matrix.target }}
- name: prepare packages (windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
set -x
export LANG=C.UTF-8
NAME=$(grep -Po 'vendor_en": "\K[^"]*' locales/en.json)
mkdir ./dist/binaries/
mv ./dist/${{ matrix.target-gnu }}/$NAME-installer.exe ./dist/binaries/$NAME-installer-${{ matrix.target-gnu }}.exe
mv ./dist/${{ matrix.target }}/$NAME-installer.exe ./dist/binaries/$NAME-installer-${{ matrix.target }}.exe
cd ./dist/${{ matrix.target-gnu }}
rm -f $NAME-${{ matrix.target-gnu }}/$NAME-installer-cli.exe
7z a ../binaries/$NAME-${{ matrix.target-gnu }}.zip $NAME-${{ matrix.target-gnu }}
cd ../${{ matrix.target }}
rm -f $NAME-${{ matrix.target }}/$NAME-installer-cli.exe
7z a ../binaries/$NAME-${{ matrix.target }}.zip $NAME-${{ matrix.target }}
- name: prepare packages (unix)
if: matrix.os != 'windows-latest'
run: |
set -x
NAME=$(grep -Po 'vendor_en": "\K[^"]*' locales/en.json)
mkdir ./dist/binaries/
mv ./dist/${{ matrix.target }}/$NAME-installer-cli ./dist/binaries/$NAME-installer-cli-${{ matrix.target }}
mv ./dist/${{ matrix.target }}/$NAME-installer ./dist/binaries/$NAME-installer-${{ matrix.target }}
cd ./dist/${{ matrix.target }}
tar cjf ../binaries/$NAME-${{ matrix.target }}.tar.xz $NAME-${{ matrix.target }}
- name: prepare packages (unix)
if: matrix.os != 'windows-latest'
run: |
set -x
NAME=$(grep -Po 'vendor_en": "\K[^"]*' locales/en.json)
sudo mkdir ./dist/binaries/
sudo mv ./dist/${{ matrix.target }}/$NAME-installer-cli ./dist/binaries/$NAME-installer-cli-${{ matrix.target }}
sudo mv ./dist/${{ matrix.target }}/$NAME-installer ./dist/binaries/$NAME-installer-${{ matrix.target }}
cd ./dist/${{ matrix.target }}
sudo tar cjf ../binaries/$NAME-${{ matrix.target }}.tar.xz $NAME-${{ matrix.target }}
- name: upload release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
generateReleaseNotes: true
artifacts: "./dist/binaries/*"
- name: upload release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
generateReleaseNotes: true
artifacts: "./dist/binaries/*"
33 changes: 13 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 2 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rim"
version = "0.3.1"
version = "0.4.0"
edition = "2021"
description = "An interactive Rust installation manager"
rust-version = "1.73.0" # Minimal required version to use `zip`
Expand Down Expand Up @@ -31,7 +31,6 @@ fern = { version = "0.7", features = ["colored"] }
[dependencies]
anyhow.workspace = true
clap = { version = "4", features = ["derive"] }
home = "0.5.9"
indicatif = "0.17"
reqwest = { version = "0.12", features = ["blocking", "native-tls-vendored"] }
serde.workspace = true
Expand All @@ -45,7 +44,6 @@ sevenz-rust = "0.6.1"
tar = "0.4"
xz2 = "0.1.7"
flate2 = "1"
common-path = "1.0.0"
cfg-if = "1"
env_proxy = "0.4.1"
indexmap.workspace = true
Expand All @@ -56,26 +54,9 @@ fern.workspace = true
chrono = "0.4.38"
semver = "1.0.23"
self-replace = "1"
os_pipe = "1.2.1"

[target."cfg(windows)".dependencies]
winreg = "0.52.0"
winapi = { version = "0.3", features = ["winuser", "winbase"] }
cc = "1"

[target."cfg(windows)".dependencies.windows-sys]
features = [
"Win32_Foundation",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_IO",
"Win32_System_Ioctl",
"Win32_System_JobObjects",
"Win32_System_Kernel",
"Win32_System_LibraryLoader",
"Win32_System_SystemInformation",
"Win32_System_SystemServices",
"Win32_System_Threading",
"Win32_System_WindowsProgramming",
]
version = "0.52.0"
41 changes: 41 additions & 0 deletions ci/docker/dist-aarch64-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 使用 Ubuntu 20.04 ARM 版本作为基础镜像
FROM arm64v8/ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

# 更新系统并安装必要的软件包
RUN apt-get update && \
apt-get install -y \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libwebkit2gtk-4.0-dev \
libappindicator3-dev \
librsvg2-dev \
perl

# 安装 Rust(确保是适用于 ARM 的目标)
COPY ci/scripts/install-rust.sh /scripts/
RUN chmod +x /scripts/install-rust.sh && \
/scripts/install-rust.sh
ENV PATH=$PATH:/root/.cargo/bin

ENV HOST_TRIPPLE aarch64-unknown-linux-gnu

# 安装 Node.js 18.x
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
RUN npm set strict-ssl false && npm install -g pnpm

# 安装 Tauri CLI
# RUN cargo install [email protected]
COPY ci/scripts/install-tauri-cli.sh /scripts/
RUN chmod +x /scripts/install-tauri-cli.sh && \
/scripts/install-tauri-cli.sh

# 执行项目构建
CMD cargo dev vendor && \
cargo dev dist
43 changes: 43 additions & 0 deletions ci/docker/dist-aarch64-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 使用 Ubuntu 20.04 ARM 版本作为基础镜像
FROM arm64v8/ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

# 更新系统并安装必要的软件包
RUN apt-get update && \
apt-get install -y \
make \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libwebkit2gtk-4.0-dev \
libappindicator3-dev \
librsvg2-dev \
perl \
musl-tools

# 安装 Rust(确保是适用于 ARM 的目标)
COPY ci/scripts/install-rust.sh /scripts/
RUN chmod +x /scripts/install-rust.sh && \
/scripts/install-rust.sh
ENV PATH=$PATH:/root/.cargo/bin

RUN rustup target add aarch64-unknown-linux-musl
ENV HOST_TRIPPLE aarch64-unknown-linux-musl

# 安装 Node.js 18.x
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs
RUN npm set strict-ssl false && npm install -g pnpm

# 安装 Tauri CLI
# RUN cargo install [email protected]
COPY ci/scripts/install-tauri-cli.sh /scripts/
RUN chmod +x /scripts/install-tauri-cli.sh && \
/scripts/install-tauri-cli.sh

# 执行项目构建
CMD cargo dev vendor && \
cargo dev dist
Loading

0 comments on commit b1b3c1d

Please sign in to comment.