diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f896826..f56470e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,6 @@ name: Cross Compilation on: - push: - branches: [ main ] - pull_request: - branches: [ main ] workflow_dispatch: jobs: @@ -23,20 +19,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Build and push Docker image - uses: docker/build-push-action@v2 - with: - context: . - push: false - load: true - tags: rust-cross-compile:latest + - name: Pull Docker image from Docker Hub + run: docker pull 255doesnotexist/lintestor-cross-compile:latest - name: Cross compile run: | - docker run --rm -v ${{ github.workspace }}:/root/src rust-cross-compile:latest \ + docker run --rm -v ${{ github.workspace }}:/root/src 255doesnotexist/lintestor-cross-compile:latest \ sh -c "cd /root/src && cargo build --release --target ${{ matrix.target }}" - name: Upload artifact @@ -67,7 +55,7 @@ jobs: prerelease: false - name: Download all artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: path: artifacts @@ -83,4 +71,4 @@ jobs: -H "Content-Type: application/octet-stream" \ "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=${asset_name}" \ --data-binary "@$artifact" - done \ No newline at end of file + done diff --git a/Dockerfile b/Dockerfile index 66eb7b4..d1867c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,17 +4,31 @@ FROM ubuntu:latest # 避免在构建过程中出现交互式提示 ENV DEBIAN_FRONTEND=noninteractive -# 安装必要的软件包和交叉编译工具链 +# 安装基本软件包和交叉编译工具链 RUN apt-get update && apt-get install -y \ software-properties-common \ - && add-apt-repository ppa:ubuntu-toolchain-r/test \ - && apt-get update && apt-get install -y \ build-essential \ curl \ git \ libssl-dev \ pkg-config \ cmake \ + gcc-aarch64-linux-gnu \ + g++-aarch64-linux-gnu \ + gcc-arm-linux-gnueabihf \ + g++-arm-linux-gnueabihf \ + gcc-riscv64-linux-gnu \ + g++-riscv64-linux-gnu \ + gcc-powerpc64-linux-gnu \ + g++-powerpc64-linux-gnu \ + gcc-i686-linux-gnu \ + g++-i686-linux-gnu \ + libc6-dev-i386 \ + && rm -rf /var/lib/apt/lists/* + +# 添加 PPA 并安装 GCC 14 和相关工具 +RUN add-apt-repository ppa:ubuntu-toolchain-r/test \ + && apt-get update && apt-get install -y \ gcc-14 \ g++-14 \ gcc-14-aarch64-linux-gnu \ @@ -27,13 +41,9 @@ RUN apt-get update && apt-get install -y \ g++-14-powerpc64-linux-gnu \ gcc-14-i686-linux-gnu \ g++-14-i686-linux-gnu \ - libc6-dev-i386 \ && rm -rf /var/lib/apt/lists/* -# 设置 GCC 14 为默认版本 -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \ - && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 - +# 设置工作目录 WORKDIR /root # 安装 Rust @@ -65,4 +75,4 @@ linker = "powerpc64-linux-gnu-gcc-14"\n\ linker = "i686-linux-gnu-gcc-14"' > ~/.cargo/config.toml # 设置默认命令 -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/bash"]