Skip to content

Commit

Permalink
ci(release): fix release workflow 255doesnotexist#28 & pull only
Browse files Browse the repository at this point in the history
- install default toolchain before installing newer toolchain
- remove docker build process
- update download-artifact to v3
  • Loading branch information
255doesnotexist committed Oct 11, 2024
1 parent 820c5c7 commit 36aaf0a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Cross Compilation

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
Expand All @@ -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
Expand Down Expand Up @@ -67,7 +55,7 @@ jobs:
prerelease: false

- name: Download all artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: artifacts

Expand All @@ -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
done
28 changes: 19 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -65,4 +75,4 @@ linker = "powerpc64-linux-gnu-gcc-14"\n\
linker = "i686-linux-gnu-gcc-14"' > ~/.cargo/config.toml

# 设置默认命令
CMD ["/bin/bash"]
CMD ["/bin/bash"]

0 comments on commit 36aaf0a

Please sign in to comment.