Skip to content

Commit adb39a1

Browse files
committed
release aarch64 on self-hosted native machine
Signed-off-by: xixi <i@hexilee.me>
1 parent c9f9290 commit adb39a1

File tree

2 files changed

+11
-64
lines changed

2 files changed

+11
-64
lines changed

.github/workflows/release.yaml

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -22,71 +22,29 @@ jobs:
2222
release_name: Release ${{ github.ref }}
2323
draft: false
2424
prerelease: false
25-
build_x86_64:
26-
name: Upload Release x86-64
25+
upload_release:
26+
name: Upload Release
2727
needs: create_release
28-
runs-on: ubuntu-latest
2928
strategy:
3029
matrix:
31-
include:
32-
- target: x86_64-unknown-linux-gnu
33-
cc: gcc
30+
arch: [x86_64, aarch64]
31+
runs-on: ${{ fromJson('{"x86_64":"ubuntu-latest", "aarch64":["self-hosted", "Linux", "ARM64"]}')[matrix.arch] }}
3432
steps:
3533
- name: Checkout code
3634
uses: actions/checkout@v2
3735
- name: Build
3836
run: |
39-
DOCKER_BUILDKIT=1 docker build --build-arg CC=${{ matrix.cc }} --build-arg TARGET=${{ matrix.target }} --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg HTTPS_PROXY=${HTTPS_PROXY} . -t chaos-mesh/tproxy
37+
DOCKER_BUILDKIT=1 docker build --build-arg HTTP_PROXY=${HTTP_PROXY} --build-arg HTTPS_PROXY=${HTTPS_PROXY} . -t chaos-mesh/tproxy
4038
docker run -v ${PWD}:/opt/mount:z --rm --entrypoint cp chaos-mesh/tproxy /tproxy /opt/mount/tproxy
41-
tar -czvf ./tproxy-${{ matrix.target }}.tar.gz ./tproxy
39+
tar -czvf ./tproxy-${{ matrix.arch }}.tar.gz ./tproxy
4240
- name: Upload Release Asset
4341
id: upload-release-asset
4442
uses: actions/upload-release-asset@v1
4543
env:
4644
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4745
with:
4846
upload_url: ${{ needs.create_release.outputs.upload_url }}
49-
asset_path: ./tproxy-${{ matrix.target }}.tar.gz
50-
asset_name: tproxy-${{ matrix.target }}.tar.gz
47+
asset_path: ./tproxy-${{ matrix.arch }}.tar.gz
48+
asset_name: tproxy-${{ matrix.arch }}.tar.gz
5149
asset_content_type: application/zip
52-
build_aarch64:
53-
name: Upload Release aarch64
54-
needs: create_release
55-
runs-on: ubuntu-latest
56-
strategy:
57-
matrix:
58-
include:
59-
- target: aarch64-unknown-linux-gnu
60-
cc: gcc-aarch64-linux-gnu
61-
steps:
62-
- name: Checkout code
63-
uses: actions/checkout@v2
64-
- name: Build
65-
uses: uraimo/run-on-arch-action@v2
66-
with:
67-
arch: aarch64
68-
distro: ubuntu20.04
69-
githubToken: ${{ secrets.GITHUB_TOKEN }}
70-
setup: |
71-
mkdir -p $HOME/tproxy
72-
dockerRunArgs: |
73-
--volume "$HOME/tproxy:/tproxy"
74-
run: |
75-
apt update
76-
apt install build-essential ${{ matrix.cc }} curl git pkg-config -y
77-
rm -rf /var/lib/apt/lists/*
78-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
79-
source $HOME/.cargo/env
80-
cargo build --release --all
81-
cp ./target/release/chaos-tproxy /tproxy/tproxy
82-
tar -czvf /tproxy/tproxy-${{ matrix.target }}.tar.gz /tproxy/tproxy
83-
- name: Upload Release Asset
84-
id: upload-release-asset
85-
uses: actions/upload-release-asset@v1
86-
env:
87-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
with:
89-
upload_url: ${{ needs.create_release.outputs.upload_url }}
90-
asset_path: $HOME/tproxy-${{ matrix.target }}.tar.gz
91-
asset_name: tproxy-${{ matrix.target }}.tar.gz
92-
asset_content_type: application/zip
50+

Dockerfile

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ENV DEBIAN_FRONTEND noninteractive
77

88
ARG HTTPS_PROXY
99
ARG HTTP_PROXY
10-
ARG TARGET=x86_64-unknown-linux-gnu
1110
ARG CC=gcc
1211

1312
ENV http_proxy $HTTP_PROXY
@@ -18,26 +17,16 @@ RUN apt-get update && apt-get install build-essential $CC curl git pkg-config -y
1817
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
1918
ENV PATH "/root/.cargo/bin:${PATH}"
2019

21-
RUN rustup toolchain install nightly-$TARGET
22-
RUN rustup target add $TARGET
23-
2420
RUN if [ -n "$HTTP_PROXY" ]; then echo "[http]\n\
2521
proxy = \"${HTTP_PROXY}\"\n\
2622
"\
2723
>> /root/.cargo/config ; fi
2824

29-
RUN echo "[target.aarch64-unknown-linux-gnu]\n\
30-
linker = \"aarch64-linux-gnu-gcc\"\n\
31-
"\
32-
>> /root/.cargo/config
33-
3425
COPY . /tproxy-build
35-
3626
WORKDIR /tproxy-build
37-
3827
RUN --mount=type=cache,target=/tproxy-build/target \
3928
--mount=type=cache,target=/root/.cargo/registry \
40-
cargo build --release --all --target $TARGET
29+
cargo build --release --all
4130

4231
RUN --mount=type=cache,target=/tproxy-build/target \
43-
cp /tproxy-build/target/$TARGET/release/chaos-tproxy /tproxy
32+
cp /tproxy-build/target/release/chaos-tproxy /tproxy

0 commit comments

Comments
 (0)